/* ===== CSS Reset & Defaults ===== */
:root {
    color-scheme: dark;
    --bg-primary: #0b0d12;
    --bg-secondary: #121620;
    --bg-tertiary: #0e1320;
    --border-color: #20283a;
    --text-primary: #e9ecf1;
    --text-secondary: #aeb6c2;
    --text-muted: #8e99aa;
    --accent-primary: #2b5cff;
    --accent-success: #25d26f;
    --accent-warning: #f4c542;
    --accent-danger: #ff4d4d;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: underline;
}

a:hover {
    opacity: 0.8;
}

/* ===== Layout ===== */
#app {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}

header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.header-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.header-text h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.2px;
}

.header-text p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    background: var(--accent-success);
}

.header-status.offline .status-dot {
    background: var(--accent-danger);
}

.header-status.error .status-dot {
    background: var(--accent-warning);
}

/* ===== Navigation ===== */
nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    flex-shrink: 0;
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
}

nav a, nav button {
    padding: 12px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    font-family: inherit;
}

nav a:hover, nav button:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-primary);
}

nav a.active, nav button.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* ===== Main Content Area ===== */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    min-width: 0;
}

.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== Cards & Sections ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.card h2 {
    margin: 0 0 16px;
    font-size: 16px;
    letter-spacing: 0.2px;
    color: var(--text-primary);
}

.card h3 {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Now Playing Card ===== */
.now-playing {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
}

.np-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
    line-height: 1.3;
    word-wrap: break-word;
}

.np-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    word-wrap: break-word;
}

.np-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.np-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.np-info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.np-info-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== Coming Up / Recent ===== */
.upcoming-list, .recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upcoming-list li, .recent-list li {
    font-size: 12px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upcoming-list li:hover, .recent-list li:hover {
    background: var(--bg-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.muted {
    color: var(--text-secondary);
}

/* ===== Footer ===== */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    flex-shrink: 0;
    text-align: center;
    font-size: 16px;
    color: var(--text-muted);
}

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

footer a:hover {
    text-decoration: underline;
}

/* ===== Forms & Buttons ===== */
.btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.btn.danger {
    background: #40202a;
    border-color: #6c2b3b;
    color: var(--accent-danger);
}

input[type="text"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(43, 92, 255, 0.2);
}

textarea {
    resize: vertical;
    min-height: 90px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== Messages ===== */
.message {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    border: 1px solid;
}

.message.success {
    background: #143a25;
    border-color: var(--accent-success);
    color: #a3f0c5;
}

.message.error {
    background: #40202a;
    border-color: var(--accent-danger);
    color: #ffb3b3;
}

.message.info {
    background: #182039;
    border-color: var(--accent-primary);
    color: #9fb8ff;
}

.message.warning {
    background: #3a3420;
    border-color: var(--accent-warning);
    color: #ffd699;
}

/* ===== Grid & Layout Utilities ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.grid.cols2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid.cols3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

thead th {
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 13px;
}

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

/* ===== Status Badge ===== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.status.ok {
    border-color: var(--accent-success);
    background: rgba(37, 210, 111, 0.1);
    color: var(--accent-success);
}

.status.warn {
    border-color: var(--accent-warning);
    background: rgba(244, 197, 66, 0.1);
    color: var(--accent-warning);
}

.status.bad {
    border-color: var(--accent-danger);
    background: rgba(255, 77, 77, 0.1);
    color: var(--accent-danger);
}

/* ===== Accessibility ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }

    .content {
        padding: 16px;
    }
}

@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 16px;
        flex-direction: row;
        gap: 16px;
        overflow-x: auto;
    }

    .sidebar > * {
        flex: 0 0 auto;
        min-width: 280px;
    }

    nav {
        flex-wrap: wrap;
    }

    header {
        flex-wrap: wrap;
    }

    .header-brand {
        flex: 1 1 100%;
        min-width: 0;
    }

    .grid.cols3 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    header {
        padding: 12px 16px;
        gap: 12px;
    }

    .header-text h1 {
        font-size: 18px;
    }

    .header-text p {
        font-size: 11px;
    }

    nav a, nav button {
        padding: 10px 16px;
        font-size: 13px;
    }

    .content {
        padding: 12px;
    }

    .sidebar {
        padding: 12px;
    }

    .card {
        padding: 14px;
    }

    .card h2 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .grid.cols3 {
        grid-template-columns: 1fr;
    }

    .grid.cols2 {
        grid-template-columns: 1fr;
    }
}

/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-track-info {
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    font-size: 14px;
}

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

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Message Styles ===== */
#searchMessage p, #modalMessage p {
padding: 12px;
border-radius: 4px;
margin: 12px 0;
}

.info {
    background: rgba(43, 92, 255, 0.1);
    border: 1px solid rgba(43, 92, 255, 0.3);
    color: var(--accent-primary);
}

.success {
    background: rgba(37, 210, 111, 0.1);
    border: 1px solid rgba(37, 210, 111, 0.3);
    color: var(--accent-success);
}

.warning {
    background: rgba(244, 197, 66, 0.1);
    border: 1px solid rgba(244, 197, 66, 0.3);
    color: var(--accent-warning);
}

.error {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--accent-danger);
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
}

.status-badge.eligible {
    background: rgba(37, 210, 111, 0.1);
    color: var(--accent-success);
    border: 1px solid rgba(37, 210, 111, 0.3);
}

.status-badge.ineligible {
    background: rgba(244, 197, 66, 0.1);
    color: var(--accent-warning);
    border: 1px solid rgba(244, 197, 66, 0.3);
}

/* ===== Request Button ===== */
.btn-request {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--accent-primary);
    background: var(--accent-primary);
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.2s;
}

.btn-request:hover:not([disabled]) {
    opacity: 0.8;
}

.btn-request:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* ===== Top Lists ===== */
.top-list {
    list-style: decimal;
    padding-left: 20px;
    margin: 12px 0 0 0;
}

.top-list li {
    padding: 6px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.top-list li.muted {
    list-style: none;
    color: var(--text-muted);
    font-style: italic;
}
