/* ============================================================
   Music Publishing Dashboard - Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ============================================================
   CSS Variables - Light Mode (default)
   ============================================================ */
:root {
    --primary:        #06dca8;
    --primary-dark:   #04b589;
    --primary-light:  #e0fdf6;
    --accent:         #242331;

    --bg:             #f4f6fb;
    --bg-card:        #ffffff;
    --bg-sidebar:     #242331;
    --bg-sidebar-alt: #1d1c2a;
    --bg-input:       #f0f3fa;
    --bg-hover:       #eef1f8;

    --text:           #1a1a2e;
    --text-muted:     #6b7280;
    --text-sidebar:   #c8cad8;
    --text-sidebar-active: #ffffff;

    --border:         #e2e6f0;
    --border-focus:   #06dca8;

    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
    --shadow-primary: 0 4px 20px rgba(6,220,168,0.25);

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    --sidebar-w:  260px;
    --topbar-h:   64px;

    --font-head:  'Syne', sans-serif;
    --font-body:  'DM Sans', sans-serif;

    --success:    #10b981;
    --warning:    #f59e0b;
    --danger:     #ef4444;
    --info:       #3b82f6;
}

/* ============================================================
   Dark Mode
   ============================================================ */
[data-theme="dark"] {
    --bg:             #171622;
    --bg-card:        #1f1e2e;
    --bg-sidebar:     #13121f;
    --bg-sidebar-alt: #0f0e1a;
    --bg-input:       #2a2938;
    --bg-hover:       #252436;

    --text:           #e8eaf2;
    --text-muted:     #8b8fa8;
    --text-sidebar:   #9a9cb0;
    --text-sidebar-active: #ffffff;

    --border:         #2e2d3d;
    --border-focus:   #06dca8;

    --shadow-sm:      0 1px 3px rgba(0,0,0,0.30);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.40);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.50);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background:  var(--bg);
    color:       var(--text);
    line-height: 1.6;
    transition:  background 0.3s, color 0.3s;
    min-height:  100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

/* ============================================================
   Layout - Sidebar + Main
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease, background 0.3s;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.sidebar-brand-name {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 16px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-sidebar);
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left-color: rgba(6,220,168,0.4);
}

.nav-item.active {
    background: rgba(6,220,168,0.12);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s, border-color 0.3s;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-title {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

/* --- Page Body --- */
.page-body {
    padding: 28px;
    flex: 1;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: background 0.3s, border-color 0.3s;
}

.card-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 24px; }

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

[data-theme="dark"] .stat-icon { background: rgba(6,220,168,0.12); }

.stat-icon svg { width: 22px; height: 22px; color: var(--primary); }

.stat-info { flex: 1; }

.stat-value {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 3px;
}

/* ============================================================
   Forms & Inputs
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
    outline: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(6,220,168,0.12);
    background: var(--bg-card);
}

.form-control::placeholder { color: var(--text-muted); opacity: 0.6; }

select.form-control { cursor: pointer; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--primary);
    color: var(--accent);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-primary);
    transform: translateY(-1px);
    color: var(--accent);
}

.btn-dark {
    background: var(--accent);
    color: #fff;
}
.btn-dark:hover { background: #1a1928; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

[data-theme="dark"] .btn-danger {
    background: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.3);
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.855rem;
}

thead tr {
    background: var(--bg);
}

[data-theme="dark"] thead tr { background: var(--bg-sidebar-alt); }

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--bg-hover); }

.table-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.badge-success { background: rgba(16,185,129,0.12); color: #059669; }
.badge-warning { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-danger  { background: rgba(239,68,68,0.12);  color: #dc2626; }
.badge-info    { background: rgba(59,130,246,0.12); color: #2563eb; }
.badge-primary { background: rgba(6,220,168,0.12);  color: #04b589; }
.badge-muted   { background: var(--bg-hover);       color: var(--text-muted); }

/* ============================================================
   Alerts / Flash
   ============================================================ */
.alert {
    padding: 13px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: rgba(16,185,129,0.10); color: #059669; border: 1px solid rgba(16,185,129,0.25); }
.alert-error   { background: rgba(239,68,68,0.10);  color: #dc2626; border: 1px solid rgba(239,68,68,0.25); }
.alert-warning { background: rgba(245,158,11,0.10); color: #d97706; border: 1px solid rgba(245,158,11,0.25); }
.alert-info    { background: rgba(59,130,246,0.10); color: #2563eb; border: 1px solid rgba(59,130,246,0.25); }

/* ============================================================
   Upload Zone
   ============================================================ */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: var(--bg);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(6,220,168,0.04);
}

.upload-zone svg {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin: 0 auto 12px;
    opacity: 0.7;
}

.upload-zone h3 {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.upload-zone p { font-size: 0.82rem; color: var(--text-muted); }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: var(--accent); border-color: var(--primary); font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 20px;
}

.filter-bar .form-group { margin-bottom: 0; }

.filter-bar .form-control { min-width: 150px; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--accent);
    position: relative;
    overflow: hidden;
}

.login-art {
    flex: 1;
    background: linear-gradient(135deg, #242331 0%, #1a1928 50%, #0f0e1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.login-art::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6,220,168,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
}

.login-art::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6,220,168,0.08) 0%, transparent 70%);
    bottom: -50px; left: -50px;
}

.login-art-content { position: relative; z-index: 1; color: #fff; max-width: 400px; }

.login-art-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    margin-bottom: 32px;
}

.login-art h1 {
    font-family: var(--font-head);
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
}

.login-art h1 span { color: var(--primary); }

.login-art p {
    color: rgba(255,255,255,0.5);
    font-size: 0.95rem;
    line-height: 1.7;
}

.login-form-panel {
    width: 440px;
    flex-shrink: 0;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.login-form-inner { width: 100%; max-width: 340px; }

.login-form-inner h2 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.login-form-inner p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 32px;
}

/* ============================================================
   Dark Mode Toggle
   ============================================================ */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ============================================================
   User Avatar / Dropdown
   ============================================================ */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 100px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
}

.user-chip:hover { border-color: var(--primary); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent);
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

/* ============================================================
   Misc Utilities
   ============================================================ */
.text-primary  { color: var(--primary); }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }

.font-head     { font-family: var(--font-head); }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .login-art { display: none; }
    .login-form-panel { width: 100%; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-body { padding: 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .login-form-panel { padding: 32px 24px; }
}
