/* --- VARIABLES (Minimalist Dark Theme) --- */
:root {
    --bg-color: #1e1e1e;
    --sidebar-bg: #1a1a1a;
    --text-main: #ededed;
    --text-muted: #999999;
    --border-color: #333333;
    --hover-bg: #2a2a2a;
    --accent: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- LAYOUT (Rolled back to original flawless version!) --- */
body {
    font-family: 'Quicksand', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    padding-bottom: 120px; 
    z-index: 1000;
}

.site-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 50px;
    letter-spacing: 0.5px;
}

.nav-group {
    margin-bottom: 30px;
}

.nav-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

/* --- MAIN CONTENT --- */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 60px 40px;
    display: flex;
    justify-content: center;
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    max-width: 600px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- PROFILE COMPONENTS --- */
.avatar {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 40px; /* Increased margin since circles are gone */
}

.bio-text {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 50px;
}

.bio-text p {
    margin-bottom: 15px;
}

/* --- SECTIONS (Music, etc) --- */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.link-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 50px;
}

.music-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}

.music-btn:hover {
    background-color: var(--hover-bg);
    border-color: #555;
}

/* --- MUSIC ALBUMS SHOWCASE --- */
.album-card {
    display: flex;
    gap: 30px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: left;
    transition: transform 0.2s, border-color 0.2s;
}

.album-card:hover {
    transform: translateY(-3px);
    border-color: #555;
}

.album-cover {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--hover-bg); /* Placeholder background */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--border-color);
}

.album-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.album-details h4 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 5px;
}

.album-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.album-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.album-links {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.album-links .music-btn {
    flex: 1;
    padding: 10px 15px;
    font-size: 0.8rem;
}

/* --- SPOTIFY WIDGET --- */
#spotify-widget {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

#spotify-widget p.nav-label { margin-bottom: 10px; }

.spotify-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

#spotify-album-art {
    width: 45px;
    height: 45px;
    border-radius: 4px;
}

.spotify-info {
    overflow: hidden;
}

#spotify-title {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#spotify-artist {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- MESSAGE BOX --- */
.message-box {
    text-align: left;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 15px;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
}

.input-group input:focus { border-color: #666; }

.send-btn {
    background: var(--text-main);
    color: var(--bg-color);
    border: none;
    padding: 0 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.send-btn:hover { background: #ccc; }

/* --- ALBUM GALLERY --- */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
}

.photo-card {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.2s;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
}

.photo-card:hover { transform: translateY(-5px); border-color: #555; }

.photo-card img { width: 100%; height: 200px; object-fit: cover; display: block; }

.photo-card .info { padding: 12px; display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }

/* --- MODAL --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 1000;
}

.glass-card {
    background: var(--bg-color); border: 1px solid var(--border-color);
    width: 90%; max-width: 900px; border-radius: 12px; position: relative;
    overflow: hidden; display: flex; flex-wrap: wrap;
}

.close-btn {
    position: absolute; top: 15px; right: 20px; background: none; border: none;
    font-size: 1.5rem; cursor: pointer; color: var(--text-muted); z-index: 10;
}

.modal-left { flex: 1.5; min-width: 300px; }
.modal-left img { width: 100%; height: 100%; object-fit: cover; max-height: 70vh; display: block; }
.modal-right { flex: 1; min-width: 300px; padding: 30px; display: flex; flex-direction: column; }
.vote-container { margin-top: auto; display: flex; align-items: center; justify-content: space-around; padding: 15px; border-top: 1px solid var(--border-color); }
.vote-btn { background: var(--sidebar-bg); border: 1px solid var(--border-color); color: var(--text-main); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.vote-btn:hover { background: #333; }
#modal-votes { font-size: 1.5rem; font-weight: bold; color: var(--text-main); display: block; }

/* TOAST */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: var(--text-main); color: var(--bg-color);
    padding: 10px 20px; border-radius: 4px; font-size: 0.9rem; font-weight: 600;
    z-index: 9999; animation: fadeOut 3s forwards;
}

@keyframes fadeOut { 0% {opacity:0;} 10% {opacity:1;} 90% {opacity:1;} 100% {opacity:0; display:none;} }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; padding: 20px; border-right: none; border-bottom: 1px solid var(--border-color); }
    .main-content { margin-left: 0; padding: 30px 20px; }
    .nav-links { flex-direction: row; flex-wrap: wrap; gap: 15px; }
    .nav-group { margin-bottom: 15px; }
    #spotify-widget { margin-top: 20px; }
    
    .album-card { flex-direction: column; align-items: center; text-align: center; padding: 20px; }
    .album-links { flex-direction: column; width: 100%; }
}

/* --- TRACKLIST --- */
.tracklist {
    margin-top: 15px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.track-item {
    font-size: 0.85rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.track-num {
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 15px;
    text-align: right;
    font-family: monospace;
}

/* --- CLICKABLE TRACK LINKS --- */
.track-link {
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid transparent; /* Invisible border for hover */
}

.track-link:hover {
    color: var(--accent);
    border-bottom: 1px solid var(--accent); /* Clean underline on hover */
}

.track-link .play-icon {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.track-link:hover .play-icon {
    color: var(--accent);
}

/* --- SIDEBAR TOGGLE & FLOATING STYLES --- */
.sidebar {
    transition: transform 0.3s ease;
    padding-bottom: 120px; /* Leaves space so scrolling doesn't hide behind Spotify */
    z-index: 1000;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.main-content {
    transition: margin-left 0.3s ease;
}
.main-content.expanded {
    margin-left: 0 !important;
}

.sidebar-toggle {
    position: absolute;
    top: 25px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.8rem;
}
.sidebar-toggle:hover { background: var(--hover-bg); color: var(--text-main); }

#sidebar-expand {
    position: fixed;
    top: 25px; left: 20px;
    z-index: 999;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px; height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: none; /* Hidden by default */
}

/* The Magic Floating Spotify Widget */
.floating-spotify {
    position: fixed;
    bottom: 25px;
    left: 20px;
    width: 220px; /* Fits perfectly inside the 260px sidebar */
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 15px;
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

/* Push header over when sidebar is hidden to avoid hamburger menu */
.main-content.expanded .page-header {
    padding-left: 45px;
    transition: padding-left 0.3s ease;
}