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

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
    --accent:        #6b7280;
    --accent-hover:  #4b5563;
    --accent-light:  #f3f4f6;
    --bg:            #f4f6f8;
    --surface:       #ffffff;
    --surface-2:     #f9fafb;
    --border:        #e5e7eb;
    --text:          #111827;
    --text-secondary:#374151;
    --muted:         #9ca3af;
    --error:         #ef4444;
    --error-bg:      #fef2f2;
    --error-border:  #fecaca;
    --success:       #22c55e;
    --success-bg:    #f0fdf4;
    --success-border:#bbf7d0;
    --radius:        8px;
    --radius-lg:     12px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:        0 4px 12px rgba(0,0,0,0.08);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Скрыть Radio из левого меню SPlayer */
.ui-menu[data-ui-page="radio"] { display: none !important; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
#cm-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 48px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 9999;
    box-shadow: var(--shadow-sm);
}

#cm-topbar .logo {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    text-decoration: none;
}

#cm-topbar .nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

#cm-topbar .nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 5px 12px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

#cm-topbar .nav a:hover {
    background: var(--accent-light);
    color: var(--accent-hover);
}

#cm-topbar .nav a.nav-active {
    color: var(--text);
    font-weight: 500;
}

#cm-topbar .nav a.upload-btn {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    padding: 5px 14px;
}

#cm-topbar .nav a.upload-btn:hover {
    background: var(--accent-hover);
    color: #fff;
}

#cm-topbar .nav a.admin-btn {
    color: var(--muted);
    font-size: 12px;
}

#cm-topbar .nav a.admin-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* ── Burger (мобиль) ─────────────────────────────────────────────────────── */
#cm-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
    border-radius: var(--radius);
}
#cm-burger:hover { background: var(--accent-light); }

#cm-mobile-nav {
    display: none;
    position: fixed;
    top: 48px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    z-index: 9998;
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 2px;
}

#cm-mobile-nav.open { display: flex; }

#cm-mobile-nav a {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 10px 12px;
    border-radius: var(--radius);
    transition: background 0.15s;
}

#cm-mobile-nav a:hover { background: var(--accent-light); color: var(--accent-hover); }
#cm-mobile-nav a.upload-btn {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
}
#cm-mobile-nav a.upload-btn:hover { background: var(--accent-hover); }

@media (max-width: 640px) {
    #cm-burger       { display: flex; align-items: center; justify-content: center; }
    #cm-topbar .nav  { display: none; }
}

/* ── Auth pages ──────────────────────────────────────────────────────────── */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.auth-logo {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 24px;
    letter-spacing: -0.3px;
    display: block;
    text-decoration: none;
}

.auth-box h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.auth-sub {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.auth-footer {
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

.auth-footer a { color: var(--accent); }
.auth-footer a:hover { color: var(--accent-hover); }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(107,114,128,0.12);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    display: inline-block;
    padding: 8px 16px;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    display: inline-block;
    padding: 7px 14px;
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error-border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}
.btn-danger:hover { background: var(--error); color: #fff; border-color: var(--error); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error-border);   color: var(--error); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: #15803d; }
.alert-info    { background: var(--accent-light); border: 1px solid var(--border);        color: var(--accent-hover); }

/* ── Cards / surfaces ────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.modal h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.cm-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 99999;
    white-space: nowrap;
    font-family: -apple-system, sans-serif;
    box-shadow: var(--shadow);
    animation: toast-in 0.2s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.page-wrap {
    padding-top: 48px; /* высота топбара */
}
