/* === Reset & Variables === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f0f17;
    --bg-card: #1a1a2e;
    --bg-surface: #22223b;
    --bg-input: #16162a;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --text: #eaeaea;
    --text-muted: #8b8fa3;
    --border: #2d2d44;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Poppins', var(--font);
    --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* === Navbar === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: rgba(15,15,23,0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}
.nav-brand:hover { color: var(--accent); }
.nav-icon { font-size: 1.5rem; }

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}
.nav-link:hover { color: var(--text); }

/* === Hero === */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45vh;
    padding: 6rem 2rem 3rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 70%, #e94560 100%);
    overflow: hidden;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(233,69,96,0.15) 0%, transparent 70%);
}
.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 700px;
}
.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}
.hero-accent { color: var(--accent); }
.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(234,234,234,0.7);
    font-weight: 300;
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* === Section === */
.section-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

/* === Songs Grid === */
.songs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.song-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}
.song-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(233,69,96,0.15);
}

.song-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-surface), var(--accent));
}
.song-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}
.song-card:hover .song-cover img { transform: scale(1.05); }

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #e94560 100%);
    opacity: 0.9;
}

.song-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity var(--transition);
}
.song-card:hover .song-play-overlay { opacity: 1; }
.play-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 20px rgba(233,69,96,0.4);
}

.song-info {
    padding: 1rem 1.25rem;
}
.song-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-artist {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}
.song-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.song-meta .likes { color: var(--accent); }
.song-meta .dislikes { color: var(--text-muted); }

/* === Loading === */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: sticky;
    top: 0;
    float: right;
    z-index: 10;
    width: 40px;
    height: 40px;
    margin: 1rem;
    border: none;
    background: var(--bg-surface);
    color: var(--text);
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition);
}
.modal-close:hover { background: var(--accent); }

.modal-body { padding: 0 2rem 2rem; clear: both; }

/* Modal Detail */
.detail-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}
.detail-cover {
    width: 200px;
    min-width: 200px;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-surface), var(--accent));
    flex-shrink: 0;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover .cover-placeholder { font-size: 4rem; border-radius: 0; }

.detail-info { flex: 1; min-width: 0; }
.detail-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.detail-artist {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.25rem;
}
.detail-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Audio Player */
.audio-player {
    width: 100%;
    margin: 1rem 0;
}
.audio-player audio {
    width: 100%;
    height: 40px;
    border-radius: var(--radius-sm);
    outline: none;
}

/* Vote Buttons */
.vote-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}
.vote-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
}
.vote-btn:hover { border-color: var(--text-muted); color: var(--text); }
.vote-btn.active-like { background: rgba(233,69,96,0.15); border-color: var(--accent); color: var(--accent); }
.vote-btn.active-dislike { background: rgba(139,143,163,0.15); border-color: var(--text-muted); color: var(--text-muted); }
.vote-btn .vote-icon { font-size: 1.1rem; }

/* Thoughts Section */
.thoughts-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}
.thoughts-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--accent);
}
.thoughts-text {
    color: rgba(234,234,234,0.85);
    font-style: italic;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Comments */
.comments-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}
.comments-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.comment-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.comment-form input {
    flex: 0 0 160px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font);
}
.comment-form textarea {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font);
    resize: vertical;
    min-height: 40px;
    max-height: 120px;
}
.comment-form input:focus, .comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-item {
    padding: 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}
.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent);
}
.comment-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.comment-text {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}
.comment-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background var(--transition);
}
.comment-delete:hover { background: rgba(239,68,68,0.15); }
.no-comments {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
    font-size: 0.9rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.form-group input[type="file"] {
    padding: 0.5rem;
    font-size: 0.85rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    min-height: 1.2em;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* === Admin === */
.admin-body { padding-top: 64px; }
.admin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 2rem;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.login-card h2 {
    font-family: var(--font-heading);
    text-align: center;
    margin-bottom: 2rem;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}
.admin-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.admin-song-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    margin-bottom: 0.75rem;
    transition: background var(--transition);
}
.admin-song-item:hover { background: var(--bg-input); }

.admin-song-cover {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-card), var(--accent));
    flex-shrink: 0;
}
.admin-song-cover img { width: 100%; height: 100%; object-fit: cover; }
.admin-song-cover .mini-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.admin-song-info { flex: 1; min-width: 0; }
.admin-song-info .title { font-weight: 600; }
.admin-song-info .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.admin-song-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.upload-progress {
    margin-top: 1rem;
    text-align: center;
}
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 300;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
.toast.success { background: var(--success); color: #0f0f17; }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* === Responsive === */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .hero { min-height: 35vh; padding: 5rem 1rem 2rem; }
    .container { padding: 1.5rem 1rem; }
    .songs-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
    .detail-header { flex-direction: column; align-items: center; text-align: center; }
    .detail-cover { width: 180px; min-width: 180px; }
    .form-row { grid-template-columns: 1fr; }
    .comment-form { flex-direction: column; }
    .comment-form input { flex: 1; }
    .modal { margin: 1rem; max-height: 95vh; }
    .modal-body { padding: 0 1.25rem 1.25rem; }
    .admin-song-item { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .songs-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .song-info { padding: 0.75rem; }
    .song-title { font-size: 0.9rem; }
    .hero-title { font-size: 2rem; }
}
