/* ================================================================
   Signage Nova – Stylesheet
   ================================================================ */

/* ── Variabler ────────────────────────────────────────────── */
:root {
    --sidebar-width: 240px;
    --sidebar-bg:    #0f1117;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active:#4361ee;
    --accent:        #4361ee;
    --accent-hover:  #3451d1;
    --topbar-h:      60px;
    --content-bg:    #f5f6fa;
    --card-bg:       #ffffff;
    --text-primary:  #1a1d2e;
    --text-muted:    #6b7280;
    --border:        #e5e7eb;
    --danger:        #ef4444;
    --success:       #22c55e;
    --warning:       #f59e0b;
    --radius:        10px;
    --shadow:        0 2px 8px rgba(0,0,0,.08);
    --shadow-md:     0 4px 16px rgba(0,0,0,.12);
}

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

/* ── App-wrapper ──────────────────────────────────────────── */
#app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .25s ease;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon { font-size: 28px; color: var(--accent); }
.brand-text  { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255,255,255,.35);
    padding: 20px 20px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    border-radius: 8px;
    margin: 1px 10px;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
}

.sidebar-link .material-symbols-outlined { font-size: 20px; }

.sidebar-footer {
    margin-top: auto;
    padding: 12px 0 6px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px 10px;
}

.sidebar-user .material-symbols-outlined { font-size: 32px; color: rgba(255,255,255,.5); }

.sidebar-user-info { display: flex; flex-direction: column; }
.sidebar-username  { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-role      { font-size: 11px; color: rgba(255,255,255,.4); }

.sidebar-logout { color: rgba(255,255,255,.5); font-size: 13px; }
.sidebar-logout:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ── Hovedinnhold ─────────────────────────────────────────── */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Topbar ───────────────────────────────────────────────── */
#topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Content-wrapper ──────────────────────────────────────── */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ── Kort ─────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* ── Statistikkort (dashboard) ───────────────────────────── */
.stat-card {
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
}

.stat-icon.blue   { background: rgba(67,97,238,.12); color: var(--accent); }
.stat-icon.green  { background: rgba(34,197,94,.12);  color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,.12); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,.12);  color: var(--danger); }

.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Skjermkort ────────────────────────────────────────────── */
.screen-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transition: box-shadow .2s, transform .2s;
    overflow: hidden;
}

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

.screen-thumb {
    background: var(--sidebar-bg);
    aspect-ratio: 16/9;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.2);
    font-size: 48px;
    position: relative;
}

.screen-thumb.portrait { aspect-ratio: 9/16; }

.screen-orientation-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.screen-card-body { padding: 14px 16px; }
.screen-card-name { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.screen-card-slug {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
    display: flex; align-items: center; gap: 4px;
}

.screen-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex; gap: 6px;
}

/* ── Spilleliste ───────────────────────────────────────────── */
.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    transition: box-shadow .15s;
}

.playlist-item:hover { box-shadow: var(--shadow); }

.playlist-item.sortable-ghost {
    opacity: .4;
    background: #e0e7ff;
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
}

.drag-handle:active { cursor: grabbing; }

.playlist-thumb {
    width: 64px; height: 36px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--sidebar-bg);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.playlist-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.playlist-thumb .material-symbols-outlined {
    color: rgba(255,255,255,.5);
    font-size: 22px;
}

.playlist-info { flex: 1; min-width: 0; }
.playlist-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.playlist-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Badge tidsvindu ──────────────────────────────────────── */
.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 100px;
    background: rgba(67,97,238,.1);
    color: var(--accent);
    font-weight: 500;
}

/* ── Tabeller ─────────────────────────────────────────────── */
.table { margin: 0; }
.table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-top: none;
}
.table td { vertical-align: middle; font-size: 14px; }
.table-hover tbody tr:hover { background: rgba(67,97,238,.04); }

/* ── Knapper ───────────────────────────────────────────────── */
.btn {
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    padding: 7px 14px;
    transition: all .15s;
}

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

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

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
}

.btn-icon .material-symbols-outlined { font-size: 17px; }

/* ── Skjema ────────────────────────────────────────────────── */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.form-control, .form-select {
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(67,97,238,.15);
}

.form-text { font-size: 12px; color: var(--text-muted); }

/* ── Opplastingsarea ──────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(67,97,238,.04);
}

.upload-zone .material-symbols-outlined {
    font-size: 48px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 10px;
}

.upload-zone p { color: var(--text-muted); font-size: 14px; margin: 0; }

/* Fremdriftslinje for opplasting */
.upload-progress { display: none; margin-top: 12px; }
.upload-progress.active { display: block; }

/* ── Modaler ───────────────────────────────────────────────── */
.modal-content { border-radius: 12px; border: none; }
.modal-header  { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-footer  { border-top: 1px solid var(--border); padding: 12px 20px; }
.modal-title   { font-size: 16px; font-weight: 700; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
    border-radius: 8px;
    font-size: 14px;
    min-width: 260px;
}

/* ── URL-badge ────────────────────────────────────────────── */
.url-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(67,97,238,.08);
    color: var(--accent);
    border: 1px solid rgba(67,97,238,.2);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: monospace;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}

.url-badge:hover { background: rgba(67,97,238,.14); }

/* ── Responsiv ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        height: 100vh;
    }

    #sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }

    #main-content { margin-left: 0 !important; }
    .sidebar-toggle { display: flex !important; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 99;
    }

    .sidebar-overlay.active { display: block; }
}

/* ── Innloggingsside ───────────────────────────────────────── */
body.login-page {
    background: linear-gradient(135deg, #0f1117 0%, #1a1d2e 100%);
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 28px;
}

.login-logo .material-symbols-outlined {
    font-size: 36px;
    color: var(--accent);
}

.login-logo span:last-child {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

/* ── Tomme tilstander ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .material-symbols-outlined {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
    opacity: .5;
}

.empty-state h5 { font-weight: 600; color: var(--text-primary); }
.empty-state p  { font-size: 14px; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Material Symbols ──────────────────────────────────────── */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
    user-select: none;
}
