/* =========================================================
   TV12 PROGRAM FLOW — GLOBAL CSS
   ---------------------------------------------------------
   Shared application styling only.

   Color definitions come from:
       css/theme-iron.css

   Page-specific styling belongs in:
       css/programs.css
       css/epg.css
       css/episodes.css
       etc.
   ========================================================= */


/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--theme-bg);
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;

    font-family: Arial, sans-serif;

    background: var(--theme-gradient-page);
    color: var(--theme-text);
}

.hidden {
    display: none !important;
}


/* =========================================================
   GENERIC LAYOUT
   ========================================================= */

.page-intro-wrapper {
    grid-column: 1 / -1;

    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;

    margin-top: 12px;
    margin-bottom: 12px;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.status {
    color: var(--theme-text-muted);
    margin-bottom: 10px;
}


/* =========================================================
   GENERIC BUTTONS
   ========================================================= */

button {
    padding: 10px 12px;

    background: var(--theme-gradient-button);
    border: 1px solid var(--theme-border-light);

    color: var(--theme-text);

    border-radius: var(--theme-button-radius);

    box-shadow: var(--theme-shadow-button);

    cursor: pointer;

    transition:
        border-color 0.15s ease,
        color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

button:hover {
    background: var(--theme-gradient-button-hover);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    box-shadow: var(--theme-accent-glow);
}

.cancel {
    background: var(--theme-gradient-button);
    border-color: var(--theme-border);
}

.cancel:hover {
    background: var(--theme-gradient-button-hover);
}


/* =========================================================
   GENERIC FORM CONTROLS
   ========================================================= */

input,
select {
    padding: 10px;

    border-radius: var(--theme-button-radius);
    border: 1px solid var(--theme-border);

    background: var(--theme-input);
    color: var(--theme-text);
}

input::placeholder,
textarea::placeholder {
    color: var(--theme-text-placeholder);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: var(--theme-input-focus-ring);
    background: var(--theme-input-focus);
}


/* =========================================================
   GENERIC GRID
   ========================================================= */

.grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 4px;
}

.cell {
    padding: 4px;
    font-size: 11px;
}

.header {
    color: var(--theme-text-muted);
    font-weight: bold;
}

.slot {
    min-height: 60px;

    border: 1px solid var(--theme-border);
    background: var(--theme-gradient-panel);

    position: relative;
}

.event {
    background: var(--theme-primary);

    margin: 2px;
    padding: 3px 6px;

    border-radius: 4px;

    font-size: 11px;
    cursor: pointer;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}


/* =========================================================
   GENERIC MODAL SYSTEM
   ========================================================= */

.modal {
    position: fixed;
    inset: 0;

    background: var(--theme-overlay);

    display: none;

    align-items: center;
    justify-content: center;

    z-index: 9999;
}

.modal.show {
    display: flex;
}

.modal-box {
    background: var(--theme-gradient-modal);

    padding: 20px;

    width: 480px;

    border-radius: var(--theme-card-radius);
    border: 1px solid var(--theme-border-light);

    box-shadow: var(--theme-shadow-modal);

    max-height: 85vh;
    overflow-y: auto;
}

.modal-box.large {
    width: 520px;
}

.modal-box input,
.modal-box select,
.modal-box textarea {
    width: 100%;
    margin-bottom: 10px;
}

.textarea-large {
    width: 100%;
    min-height: 140px;
    max-height: 300px;

    padding: 10px;

    border-radius: 8px;
    border: 1px solid var(--theme-border);

    background: var(--theme-input);
    color: var(--theme-text);

    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;

    resize: vertical;
}

.delete-btn {
    background: transparent;
    border: none;

    color: var(--theme-danger);

    cursor: pointer;
    font-size: 14px;
}


/* =========================================================
   GENERIC CARDS / BADGES
   ========================================================= */

.card {
    padding: 10px;

    border: 1px solid var(--theme-border);
    border-radius: var(--theme-card-radius);

    background: var(--theme-gradient-panel);

    box-shadow:
        var(--theme-shadow-card),
        var(--theme-highlight-inset);

    display: flex;
    justify-content: space-between;
    align-items: center;

    cursor: pointer;
}

.badge {
    font-size: 11px;

    padding: 2px 6px;

    background: var(--theme-badge-bg);
    color: var(--theme-primary);

    border: 1px solid var(--theme-badge-border);
    border-radius: var(--theme-badge-radius);
    margin-left: 6px;
}


/* =========================================================
   MODAL CONTENT
   ========================================================= */

.modal-content {
    background: var(--theme-gradient-modal);

    padding: 20px;

    width: 320px;

    border-radius: var(--theme-card-radius);
    border: 1px solid var(--theme-border-light);

    box-shadow: var(--theme-shadow-modal);

    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

/* =========================================================
   GLOBAL TOPBAR
   ---------------------------------------------------------
   Shared by all pages.
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    min-height: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 10px 18px;

    box-sizing: border-box;

    border-bottom: 1px solid var(--theme-border);
    background: var(--theme-gradient-topbar);
    box-shadow: var(--theme-shadow-topbar);
}

/* ---------------- LEFT SIDE ---------------- */

.topbar-left {
    display: flex;
    align-items: center;

    gap: 14px;

    min-width: 0;
}

.title {
    display: flex;
    align-items: center;

    gap: 10px;

    min-width: 0;
}

.title-icon {
    font-size: 25px;
    line-height: 1;
}

.title-main {
    font-size: 20px;
    font-weight: 700;

    line-height: 1.15;

    color: var(--theme-text);
}

.title-sub {
    margin-top: 2px;

    font-size: 11px;

    color: var(--theme-text-muted);
}

/* ---------------- RIGHT SIDE ---------------- */

.topbar-right {
    display: flex;
    align-items: center;

    gap: 12px;
}

.topbar-page-status {
    display: flex;
    align-items: center;

    gap: 7px;

    padding: 6px 10px;

    border: 1px solid var(--theme-border);
    border-radius: 20px;

    color: var(--theme-text-secondary);

    font-size: 12px;

    white-space: nowrap;
}

.topbar-status-dot {
    width: 7px;
    height: 7px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--theme-success);
}


/* =========================================================
   TOPBAR / HAMBURGER
   ========================================================= */

.hamburger {
    background: transparent;
    border: none;

    color: var(--theme-text);

    font-size: 20px;
    cursor: pointer;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    position: fixed;

    top: 64px;
    left: -240px;

    width: 220px;

    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);

    display: flex;
    flex-direction: column;

    background: var(--theme-gradient-sidebar);
    border-right: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow-sidebar);

    padding: 12px;

    transition: 0.2s;

    z-index: 1001;

    overflow: hidden;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--theme-border);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--theme-text);
}

.sidebar-subtitle {
    margin-top: 3px;
    font-size: 11px;
    color: var(--theme-text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;

    padding: 10px;

    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.sidebar-nav a {
    display: flex;
    align-items: center;

    gap: 11px;

    min-height: 42px;

    padding: 0 12px;
    margin-bottom: 3px;

    border-radius: 8px;

    color: var(--theme-text-secondary);

    text-decoration: none;

    font-size: 13px;
    font-weight: 600;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.sidebar-nav a:hover {
    background: var(--theme-nav-hover);
    color: var(--theme-primary);
    border-left: 2px solid transparent;
}

.sidebar-nav a.active {
    background: var(--theme-nav-active);
    color: var(--theme-primary);
    border-left: 2px solid var(--theme-primary);
    box-shadow: var(--theme-nav-active-shadow);
}

.sidebar-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.sidebar-section {
    margin: 18px 12px 6px;
    padding-top: 8px;

    border-top: 1px solid var(--theme-border);
}

.sidebar-section-title {
    display: block;

    color: var(--theme-text-muted);

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}


/* =========================================================
   MENU SCROLL LOCK
   ========================================================= */

html.menu-open,
body.menu-open {
    overflow: hidden;
    overscroll-behavior: none;
}

body.menu-open .sidebar-nav {
    touch-action: pan-y;
}


/* =========================================================
   OVERLAY
   ========================================================= */

.overlay {
    position: fixed;
    inset: 0;

    background: var(--theme-overlay);

    display: none;

    z-index: 1000;
}

.overlay.show {
    display: block;
}


/* =========================================================
   EPISODE SIDE PANEL
   ---------------------------------------------------------
   Shared panel used by pages that expose the episode drawer.
   ========================================================= */

.episode-panel {
    position: fixed;

    right: 0;
    top: 0;

    width: 420px;
    height: 100vh;

    background: var(--theme-gradient-panel);

    border-left: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow-sidebar);

    z-index: 9999;

    display: flex;
    flex-direction: column;
}

.episode-header {
    padding: 12px;

    display: flex;
    justify-content: space-between;

    border-bottom: 1px solid var(--theme-border);
}

.episode-list {
    flex: 1;

    overflow-y: auto;

    padding: 10px;
}

.episode-footer {
    padding: 10px;

    border-top: 1px solid var(--theme-border);

    display: flex;
    gap: 8px;
}


/* =========================================================
   APPLICATION SIGNATURE
   ========================================================= */

.app-signature {
    text-align: center;

    padding: 24px 12px 16px;

    color: var(--theme-text-muted);

    font-size: 11px;
    letter-spacing: 0.06em;
}

.app-signature span {
    color: var(--theme-primary);

    text-shadow:
        0 0 6px var(--theme-primary-glow);
}


/* =========================================================
   MOBILE GLOBAL
   ========================================================= */

@media (max-width: 600px) {

    body {
        padding: 12px;
    }

    .app-signature {
        padding: 20px 10px 12px;
        font-size: 10px;
        letter-spacing: 0.04em;
    }

    .modal-box {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }
}

@media (max-width: 600px) {

    .episode-panel {
        width: 100%;
    }
}

@media (max-width: 700px) {

    .topbar {
        padding: 9px 12px;
    }

    .topbar-right {
        gap: 6px;
    }

    .topbar-page-status {
        display: none;
    }

    .title-icon {
        font-size: 22px;
    }

    .title-main {
        font-size: 18px;
    }

    .title-sub {
        display: none;
    }
}

@media (min-width: 700px) {

    .episode-panel {
        width: 520px;
    }
}




/* =========================================================
   PAGE INTRO
   ---------------------------------------------------------
   Shared page title / introduction component.
   ========================================================= */

.pages-intro {
    margin-bottom: 24px;
}

.pages-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--theme-text-muted);
    margin-bottom: 5px;
}

.pages-intro h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

.pages-intro p {
    margin: 7px 0 0;
    color: var(--theme-text-muted);
    font-size: 14px;
}
