/* =========================================================
   CORE · DESIGN SYSTEM (KOMPAKTNÍ VERZE)
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root{
    /* BARVY - téměř černé */
    --bg-0:        #000000;
    --bg-1:        #050709;
    --bg-2:        #0a0d12;
    --bg-3:        #11151c;
    --bg-4:        #181d25;

    --border:      #1a2030;
    --border-2:    #252d3e;
    --border-hi:   #38425a;

    --text-0:      #f0f4fa;
    --text-1:      #d5dae3;
    --text-2:      #8d97a8;
    --text-3:      #5c6676;
    --text-muted:  #3f4858;

    /* ACCENT - neonově svítivá zelená */
    --accent:      #00ff6a;
    --accent-2:    #33ff88;
    --accent-dim:  #00cc55;
    --accent-soft: rgba(0, 255, 106, 0.15);
    --accent-glow: rgba(0, 255, 106, 0.5);

    --info:        #00e5ff;
    --warn:        #ffb800;
    --danger:      #ff2d55;
    --danger-soft: rgba(255, 45, 85, 0.14);

    /* RADIUS */
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 8px;

    /* STINY */
    --shadow-1: 0 1px 2px rgba(0,0,0,.5);
    --shadow-2: 0 4px 20px rgba(0,0,0,.6);
    --shadow-glow: 0 0 0 2px var(--accent-soft);

    /* LAYOUT */
    --topbar-h: 38px;
    --green-h: 2px;
    --base-font: 13px;
}

*{ box-sizing: border-box; }

html,body{
    margin: 0;
    padding: 0;
    width: 1280px;
    min-height: 100vh;
    background: var(--bg-0);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-1);
    font-size: var(--base-font);
    line-height: 1.35;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection{
    background: var(--accent-soft);
    color: var(--text-0);
}

/* SCROLLBAR */
::-webkit-scrollbar{ width: 8px; height: 8px; }
::-webkit-scrollbar-track{ background: var(--bg-1); }
::-webkit-scrollbar-thumb{
    background: var(--border-2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover{ background: var(--border-hi); }

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

.topbar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    z-index: 9999;
    border-bottom: 1px solid var(--border);
}

.menu{
    display: flex;
    gap: 2px;
    align-items: center;
    height: 100%;
}

.menu-item{
    position: relative;
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
}

.menu-item a,
.menu-item a:visited,
.menu-item a:active,
.menu-item span{
    color: var(--text-2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: var(--r-sm);
    transition: color .12s ease, background-color .12s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.menu-item:hover > a,
.menu-item:hover > span{
    color: var(--text-0);
    background: var(--bg-3);
}

.menu-item a.active,
.menu-item span.active{
    background: var(--accent-soft);
    color: var(--accent);
}

/* DROPDOWN */

.dropdown-content{
    display: none;
    position: absolute;
    top: calc(var(--topbar-h) - 4px);
    left: 0;
    background: var(--bg-2);
    border: 1px solid var(--border);
    min-width: 170px;
    border-radius: var(--r-md);
    overflow: hidden;
    padding: 3px;
    box-shadow: var(--shadow-2);
    animation: dropIn .12s ease;
}

@keyframes dropIn{
    from{ opacity: 0; transform: translateY(-2px); }
    to  { opacity: 1; transform: translateY(0); }
}

.dropdown-content a{
    display: block;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 3px;
}

.dropdown-content a:hover{
    background: var(--bg-3);
    color: var(--text-0);
}

.menu-item.dropdown:hover .dropdown-content{ display: block; }

/* PRAVÁ STRANA */

.menu-right{
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-box{
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 11px;
    padding: 3px 7px;
    border-radius: var(--r-sm);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    line-height: 1.2;
}

.status-box span{
    color: var(--accent);
    min-width: 22px;
    display: inline-block;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---- Speedtest status-box (verze 00-03) ---- */
.status-box.st-status{
    transition: all .14s ease;
    border-color: var(--border-2);
    color: var(--text-1);
}
.status-box.st-status:hover{
    border-color: var(--accent);
    background: var(--bg-3);
    color: var(--text-0);
}
.status-box.st-status.st-good{ border-color: rgba(0,255,106,0.45); }
.status-box.st-status.st-good span{ color: var(--accent); }
.status-box.st-status.st-warn{ border-color: rgba(255,184,0,0.45); }
.status-box.st-status.st-warn span{ color: #ffb800; }
.status-box.st-status.st-bad { border-color: rgba(255,45,85,0.45); }
.status-box.st-status.st-bad  span{ color: var(--danger); }

/* ---- Počet právě běžících streamů ---- */
.status-box.st-streams{
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, color .2s ease;
    border-color: var(--border-2);
    color: var(--text-1);
}
.status-box.st-streams:hover{ filter: brightness(1.15); }
.status-box.st-streams.st-streams-green{
    border-color: rgba(0,255,106,0.55);
    background: rgba(0,255,106,0.08);
    box-shadow: 0 0 10px rgba(0,255,106,0.18);
}
.status-box.st-streams.st-streams-green span{ color: var(--accent); }
.status-box.st-streams.st-streams-yellow{
    border-color: rgba(255,184,0,0.6);
    background: rgba(255,184,0,0.10);
    box-shadow: 0 0 10px rgba(255,184,0,0.22);
}
.status-box.st-streams.st-streams-yellow span{ color: #ffb800; }
.status-box.st-streams.st-streams-red{
    border-color: rgba(255,45,85,0.65);
    background: rgba(255,45,85,0.12);
    box-shadow: 0 0 12px rgba(255,45,85,0.28);
}
.status-box.st-streams.st-streams-red span{ color: var(--danger); }


#paymentMenuBanner{ border-color: rgba(0,255,106,0.6); background: rgba(0,255,106,0.08); }
#paymentMenuBanner span{ color: var(--accent); font-weight: 800; }
#paymentMenuBanner.pay-blink{ animation: payBlink 1.1s ease-in-out infinite; }
@keyframes payBlink{
    0%,100%{ box-shadow: 0 0 0 0 rgba(0,255,106,0.0); border-color: rgba(0,255,106,0.6); }
    50%    { box-shadow: 0 0 10px 2px rgba(0,255,106,0.45); border-color: rgba(0,255,106,1); }
}

.status-separator{
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 2px;
}

.reload-btn{
    width: 24px;
    height: 24px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    cursor: pointer;
    transition: all .12s ease;
    font-size: 12px;
}

.reload-btn:hover{
    background: var(--bg-3);
    color: var(--text-0);
    border-color: var(--border-hi);
}

.search{
    background: var(--bg-1);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 4px 8px;
    border-radius: var(--r-sm);
    font-size: 12px;
    height: 24px;
}

.search:focus{
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* POWER BUTTON */

.power-btn{
    width: 24px;
    height: 24px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .12s ease;
}

.power-btn:hover{
    background: var(--danger-soft);
    border-color: var(--danger);
}

.power-symbol{
    position: relative;
    width: 10px;
    height: 10px;
    border: 2px solid var(--danger);
    border-radius: 50%;
}

.power-symbol::after{
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 5px;
    background: var(--danger);
}

/* HAMBURGER */

.mobile-menu-toggle{
    display: none;
    width: 28px;
    height: 26px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.mobile-menu-toggle span{
    width: 14px;
    height: 2px;
    background: var(--text-1);
    border-radius: 1px;
}

/* ==================== ZELENÁ LINKA ==================== */

.menu-green-line{
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    height: var(--green-h);
    background: linear-gradient(90deg, var(--accent), var(--info));
    z-index: 9998;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ==================== WRAPPER ==================== */

.wrapper{
    padding: 10px;
    margin-top: calc(var(--topbar-h) + var(--green-h) + 6px);
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== CARD HEAD STICKY (verze 00-03) ====================
   Wrapper okolo .statusbar + .green-line. Drží oba elementy POHROMADĚ
   sticky pod topbarem na VŠECH stránkách (programs, users, packages,
   provider, epg, statistiky, update, logs, system_info, health, …).
   Předtím se .green-line odděloval od statusbaru → teď ne.
============================================================ */
.card-head-sticky{
    position: sticky;
    top: calc(var(--topbar-h) + var(--green-h));
    z-index: 200;
    background: var(--bg-0);
}

.statusbar{
    background: var(--bg-2);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-0);
    border-radius: var(--r-md) var(--r-md) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
}

/* ==================== SCROLL AREA (vnitřní scroll v kartě) ==================== */
/* Pomocná třída pro karty kde se má scrollovat JEN obsah (např. Update – zálohy,
   Statistiky – top streamy/uživatelé, Logs – výpis). Aplikuj v rámci .table-box
   nebo na vlastní wrapper. Vrch karty (.statusbar) zůstává sticky díky
   pravidlu výše. */
.scroll-area{
    max-height: calc(100vh - var(--topbar-h) - var(--green-h) - 80px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Specifické scroll oblasti pro panely zmíněné uživatelem */

/* Update karta – samostatné scroll-zóny pro "zálohy core" a "zálohy db" */
.upd-section-scroll{
    max-height: 38vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-1);
}

/* Statistiky karta – top streamy / top uživatelé scroll */
.stats-list-scroll{
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Logs karta – log-viewer (aplikace/aktivita/HTTP záložky jsou sticky) */
.logs-tabs-row{
    position: sticky;
    top: 0;
    background: var(--bg-2);
    z-index: 50;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.logs-output-scroll{
    max-height: calc(100vh - var(--topbar-h) - var(--green-h) - 140px);
    overflow-y: auto;
    overflow-x: auto;
    background: var(--bg-1);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 8px;
}

.statusbar-title{
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.statusbar-title::before{
    content: '';
    width: 3px;
    height: 13px;
    background: var(--accent);
    border-radius: 1px;
}

.invalid{ margin-left: 14px; color: var(--danger); }

.green-line{
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

/* ==================== TABLE BOX ==================== */

.table-box{
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--r-md) var(--r-md);
    overflow: hidden;
}

table{
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead{
    background: var(--bg-2);
}

thead th{
    padding: 5px 8px;
    color: var(--text-3);
    font-weight: 600;
    text-align: left;
    font-size: 11px;
    letter-spacing: .3px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    height: 24px;
}

tbody tr{
    border-top: 1px solid rgba(36,44,56,.4);
    transition: background .1s ease;
}

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

tbody td{
    padding: 4px 8px;
    color: var(--text-1);
    vertical-align: middle;
    height: 26px;
}

/* ==================== BADGES ==================== */

.badge{
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: .2px;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.4;
}

.badge.green{
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(16,217,163,0.25);
}

.badge.red{
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(244,63,94,0.25);
}

/* ==================== TAGS ==================== */

.tag{
    background: var(--bg-3);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: var(--text-2);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    margin-right: 2px;
    display: inline-block;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

/* zdrojové badge 1/2/3 */
.tag-src{ min-width: 22px; padding: 1px 7px; }
.tag-active{
    background: #10d9a3;
    color: #001507;
    border-color: #10d9a3;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(16,217,163,0.55);
}
.tag-active:hover{ background: #0fa882; border-color: #0fa882; }
.tag-link{
    background: #1a2a3a;
    color: #8fb7ff;
    border-color: #1f4f7f;
    cursor: pointer;
    font-weight: 600;
}
.tag-link:hover{ background: #25405e; color: #cfe5ff; }
.tag-legacy{ background: #2f2f24; color: #b8b36a; border-color: #3d3d2c; }
.tag-empty{ background: #16202b; color: #445064; border-color: #1d2631; }

.mode{ color: var(--danger); font-weight: 600; font-size: 11px; }
.ok{ color: var(--accent); font-weight: 600; }
.redtext{ color: var(--danger); }
.greentext{ color: var(--accent); }

/* ==================== AKCE ==================== */

.actions{
    display: flex;
    gap: 2px;
    align-items: center;
    flex-wrap: nowrap;
}

.action-btn{
    width: 22px;
    height: 22px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    font-size: 11px;
    cursor: pointer;
    transition: all .12s ease;
    user-select: none;
    flex-shrink: 0;
}

.action-btn:hover{
    background: var(--bg-3);
    border-color: var(--border-hi);
    color: var(--text-0);
}

/* ==================== API OFFLINE OVERLAY ==================== */

#apiOfflineOverlay{
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 20, 0.95);
    backdrop-filter: blur(6px);
    color: var(--danger);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    z-index: 99999;
    text-align: center;
    padding: 16px;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 900px){

    :root{ --topbar-h: 40px; --base-font: 13px; }

    .wrapper{ padding: 8px; }
    .topbar{ padding: 0 10px; }

    .mobile-menu-toggle{ display: flex; }

    .menu{
        display: none;
        position: fixed;
        top: calc(var(--topbar-h) + var(--green-h));
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-1);
        border-bottom: 1px solid var(--border);
        padding: 6px;
        gap: 1px;
        height: auto;
        z-index: 9990;
        box-shadow: var(--shadow-2);
    }

    .menu.open{ display: flex; }

    .menu-item{ height: auto; width: 100%; }

    .menu-item a,
    .menu-item span{
        width: 100%;
        padding: 9px 12px;
        font-size: 13px;
    }

    .dropdown-content{
        position: static;
        border: none;
        background: var(--bg-2);
        margin-top: 2px;
        box-shadow: none;
        padding: 2px;
    }

    .menu-item.dropdown:hover .dropdown-content{ display: none; }
    .menu-item.dropdown.open .dropdown-content{ display: block; }

    .menu-right{ gap: 4px; }

    .status-box{ display: none; }
    .status-box.st-status,
    .status-box:first-child,
    .status-box:nth-child(2){ display: block; }
    .status-separator{ display: none; }

    .statusbar{ padding: 6px 10px; font-size: 12px; }
    thead th{ padding: 4px 6px; font-size: 10px; }
    tbody td{ padding: 4px 6px; font-size: 12px; }
}

@media (max-width: 560px){
    .wrapper{ padding: 6px; }
    .menu-right .status-box{ display: none !important; }
    .table-box{ overflow-x: auto; }
    .table-box table{ min-width: 560px; }
}

/* =========================================================
   verze_core-00-03 – sticky pravidla jsou teď v .card-head-sticky.
   Zachovány jen pomocné scroll oblasti.
   ========================================================= */
.scroll-area{
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sticky thead se aplikuje JEN na konkrétních stránkách
   (users_active, resellers, health) – v jejich vlastních CSS / JS.
   Zde NEPOUŽÍVAT globální `.table-box thead th { position: sticky }`,
   na /programs / /users atd. by to vytvořilo dvojitý sticky pruh
   "Programy" + "ID/Logo/Název" pod ním. */
