/* ── Audio Platform Admin CSS ── */
:root {
    --bg: #0b1e4a;
    --bg-gradient: linear-gradient(180deg, #0b1e4a 0%, #05102a 60%, #000000 100%);
    --surface: #fff;
    --surface-elev: #fafbff;
    --border: #e2e2e2;
    --text: #1a1a1a;
    --text-muted: #666;
    --primary: #0b1e4a;
    --primary-hover: #05102a;
    --accent: #4a7fd6;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --sidebar-bg: #05102a;
    --sidebar-text: #b8c5e0;
    --sidebar-active: #fff;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg-gradient); background-attachment: fixed; color: var(--text); line-height: 1.5; font-size: 14px; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text); padding: 20px 0; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.06); overflow-y: auto; }
.sidebar-logo { display: block; padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.sidebar-logo img { width: 100%; max-width: 200px; height: auto; display: block; transition: opacity .15s; }
.sidebar-logo:hover img { opacity: .8; }
.sidebar-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #7a8db8; padding: 14px 20px 6px; }
.sidebar nav { flex: 1; }
.sidebar a:not(.sidebar-logo) { display: block; padding: 8px 20px; color: var(--sidebar-text); font-size: 13px; transition: background .15s; }
.sidebar a:not(.sidebar-logo):hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.sidebar a.active { color: var(--sidebar-active); background: rgba(255,255,255,.12); font-weight: 600; }
.label-chip { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding-top: 6px; }
.sidebar-footer a { display: block; padding: 8px 20px; font-size: 13px; color: var(--sidebar-text); }
.sidebar-footer a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }

.main { margin-left: 240px; flex: 1; padding: 24px 32px; max-width: 1200px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 600; color: #fff; }
.page-header .breadcrumb { font-size: 13px; color: #b8c5e0; }
.page-header .breadcrumb a { color: #b8c5e0; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.15); margin-bottom: 16px; }
.card h2 { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.card-tight { padding: 14px 16px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.stat-card .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 4px; color: var(--primary); line-height: 1.1; }
.stat-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Project grid (dashboard / list) */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.project-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.project-cover { aspect-ratio: 1; background: #e5e7eb; background-size: cover; background-position: center; position: relative; }
.project-cover.no-cover { display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; }
.project-cover .label-tag { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 11px; }
.project-info { padding: 12px 14px; }
.project-info .title { font-weight: 600; font-size: 14px; line-height: 1.3; margin-bottom: 2px; }
.project-info .artist { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.project-info .meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.project-info .meta span { display: inline-flex; align-items: center; gap: 3px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.form-group label .req { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; font-family: inherit; background: #fff;
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,127,214,.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.input-with-prefix { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.input-with-prefix .prefix { background: #f5f5f5; padding: 9px 12px; font-size: 13px; color: var(--text-muted); border-right: 1px solid var(--border); white-space: nowrap; }
.input-with-prefix input { border: none; flex: 1; }
.input-with-prefix input:focus { box-shadow: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; background: #fff; color: var(--text); transition: all .15s; font-family: inherit; text-decoration: none; }
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: #fafafa; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.badge-draft { background: #e0e7ff; color: #3730a3; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-archived { background: #f3f4f6; color: #6b7280; }

/* Track editor */
.track-list { background: var(--surface); border-radius: var(--radius); padding: 0; overflow: hidden; }
.track-row { display: grid; grid-template-columns: 40px 1fr 100px 200px 100px; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.track-row:last-child { border-bottom: none; }
.track-row .pos { color: var(--text-muted); font-size: 12px; cursor: grab; }
.track-row .title-input { font-weight: 500; }
.track-row .duration { font-size: 12px; color: var(--text-muted); text-align: right; }
.track-row .files { display: flex; gap: 6px; font-size: 11px; }
.track-row .files .pill { background: #f3f4f6; padding: 3px 8px; border-radius: 999px; color: var(--text-muted); }
.track-row .files .pill.has { background: #dcfce7; color: #166534; }

.track-row .actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Upload progress */
.upload-progress { background: #f3f4f6; border-radius: 4px; overflow: hidden; height: 6px; margin-top: 4px; }
.upload-progress-bar { background: var(--accent); height: 100%; transition: width .2s; }

/* Cover upload area */
.cover-upload { width: 200px; aspect-ratio: 1; background: #f3f4f6; border: 2px dashed #cbd5e1; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; }
.cover-upload:hover { border-color: var(--accent); background: #eff6ff; }
.cover-upload img { width: 100%; height: 100%; object-fit: cover; }
.cover-upload-text { color: var(--text-muted); font-size: 12px; text-align: center; padding: 12px; }

/* Toolbar */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; background: rgba(255,255,255,.06); padding: 10px 14px; border-radius: var(--radius); }
.toolbar input[type="text"] { padding: 7px 12px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; min-width: 200px; background: #fff; }
.toolbar select { padding: 7px 12px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; background: #fff; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid rgba(255,255,255,.15); margin-bottom: 20px; }
.tab { padding: 8px 16px; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: #b8c5e0; }
.tab:hover { color: #fff; }
.tab.active { color: #fff; border-bottom-color: #fff; font-weight: 600; }

/* Recipient table */
.recipient-table .activity { font-size: 11px; color: var(--text-muted); }
.recipient-table .activity .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.recipient-table .activity .dot.active { background: var(--success); }
.recipient-table .activity .dot.sent { background: var(--warning); }
.recipient-table .activity .dot.none { background: #e5e7eb; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: var(--radius); color: #fff; font-size: 13px; z-index: 2000; animation: slideIn .25s ease; max-width: 360px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--surface); border-radius: 10px; padding: 24px; max-width: 600px; width: 90vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.modal h2 { font-size: 18px; margin-bottom: 16px; color: var(--text); text-transform: none; letter-spacing: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Login redirect message */
.login-redirect { display: flex; align-items: center; justify-content: center; min-height: 100vh; text-align: center; color: #fff; }
.login-redirect .box { background: rgba(255,255,255,.06); padding: 40px; border-radius: 10px; max-width: 400px; }
.login-redirect h1 { font-size: 22px; margin-bottom: 12px; }
.login-redirect p { color: #b8c5e0; margin-bottom: 24px; }

/* Project edit header — looks like a stage with cover */
.project-stage { display: flex; gap: 24px; align-items: flex-start; background: var(--surface); padding: 20px; border-radius: var(--radius); margin-bottom: 16px; }
.project-stage .cover-area { flex: 0 0 200px; }
.project-stage .meta-area { flex: 1; }
.project-stage h1 { font-size: 24px; color: var(--text); margin-bottom: 4px; }
.project-stage .artist { font-size: 18px; color: var(--text-muted); margin-bottom: 12px; }
.project-stage .links { font-size: 12px; color: var(--text-muted); }
.project-stage .links a { word-break: break-all; }

/* Feedback list */
.feedback-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.feedback-item:last-child { border-bottom: none; }
.feedback-item .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.feedback-item .stars { color: var(--warning); font-size: 14px; letter-spacing: 2px; }
.feedback-item .fav { font-size: 12px; color: var(--accent); margin-top: 2px; }
.feedback-item .comment { color: var(--text); margin-top: 6px; font-style: italic; }

/* Mobile */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .track-row { grid-template-columns: 30px 1fr; row-gap: 8px; }
    .track-row > * { grid-column: 2; }
    .track-row .pos { grid-column: 1; grid-row: 1 / span 2; }
    .project-stage { flex-direction: column; }
    .project-stage .cover-area { width: 100%; }
}

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
.spinner-dark { border-color: rgba(0,0,0,.2); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
