/**
 * FINAL_CSS - kompletní náhrada public/assets/css/style.css.
 * Obsahuje: světlé téma (výchozí), tmavé téma přes [data-theme="dark"],
 * opravený topbar/mobilní menu (proměnná --topbar-bg reagující na téma),
 * záložky, grafy, gauge bary, ISO panel, DNS/hostname formulář,
 * status-unknown (šedý stav "nelze ověřit"), admin rozhraní.
 */

:root {
    --bg: #f4f6fb;
    --bg-alt: #ffffff;
    --card: #ffffff;
    --card-hover: #f4f7fd;
    --border: #e3e7f0;
    --border-light: #cfd6e4;
    --text: #171a24;
    --text-dim: #636b80;
    --text-faint: #97a0b3;
    --accent: #4f6df0;
    --accent-hover: #3d5adf;
    --green: #1fa971;
    --green-bg: #e7f8f0;
    --red: #e0334f;
    --red-bg: #fdeaee;
    --yellow: #b9820f;
    --yellow-bg: #fdf3de;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(23,26,36,0.06);
    --shadow-lg: 0 14px 40px rgba(23,26,36,0.12);
    --topbar-bg: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] {
    --bg: #0b0d12;
    --bg-alt: #12151d;
    --card: #171b26;
    --card-hover: #1d2230;
    --border: #262b3a;
    --border-light: #333a4d;
    --text: #eef0f4;
    --text-dim: #97a0b5;
    --text-faint: #656e82;
    --accent: #6c8bff;
    --accent-hover: #85a0ff;
    --green: #3ecf8e;
    --green-bg: rgba(62,207,142,.15);
    --red: #f0596b;
    --red-bg: rgba(240,89,107,.15);
    --yellow: #e8b84b;
    --yellow-bg: rgba(232,184,75,.15);
    --shadow: 0 4px 18px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);
    --topbar-bg: rgba(18, 21, 29, 0.85);
}

html[data-theme="dark"] body {
    background: radial-gradient(circle at top, #141824 0%, var(--bg) 55%);
}

html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .iso-select-row select,
html[data-theme="dark"] #hostname-label-input {
    background: var(--bg) !important;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: linear-gradient(180deg, #eef1f8 0%, var(--bg) 340px);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* přechod barev při přepnutí tématu ať to není trhané */
body, .card, .plan-card, .vm-row, .stat-card, .btn, header.topbar, .admin-sidebar, .admin-content {
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- TOPBAR ---------- */
header.topbar {
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; max-width: 1180px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); display: flex; align-items: center; gap: 6px; letter-spacing: -0.02em; }
.brand .dot { color: var(--accent); }
nav.main-nav { display: flex; gap: 22px; align-items: center; }
nav.main-nav a { color: var(--text-dim); font-size: 0.93rem; font-weight: 500; }
nav.main-nav a:hover, nav.main-nav a.active { color: var(--text); }
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* ---------- PŘEPÍNAČ SVĚTLÝ/TMAVÝ ---------- */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    padding: 0;
    color: var(--text) !important;
    transition: border-color .15s ease, background .15s ease;
}
.theme-toggle-btn:hover { border-color: var(--accent); background: var(--card-hover); }
.theme-icon-dark { display: none; }
.theme-icon-light { display: inline; }
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: inline; }

/* ---------- TLAČÍTKA ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border-light);
    background: var(--card); color: var(--text) !important; cursor: pointer;
    font-size: 0.92rem; font-weight: 500; font-family: inherit;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
    -webkit-appearance: none; appearance: none;
}
.btn:hover { background: var(--card-hover); border-color: var(--accent); color: var(--text) !important; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff !important; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff !important; }
.btn-danger { background: var(--red-bg); border-color: var(--red-bg); color: var(--red) !important; }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #ffffff !important; }
.btn-success { background: var(--green); border-color: var(--green); color: #ffffff !important; }
.btn-success:hover { background: #178f60; border-color: #178f60; color: #ffffff !important; }
.btn-sm { padding: 6px 13px; font-size: 0.82rem; border-radius: 8px; }
.btn-block { width: 100%; }

.copy-btn {
    background: var(--bg); border: 1px solid var(--border-light); color: var(--text-dim) !important;
    border-radius: 8px; padding: 5px 10px; font-size: 0.76rem; cursor: pointer; white-space: nowrap;
    transition: all .15s ease;
}
.copy-btn:hover { border-color: var(--accent); color: var(--text) !important; background: #fff; }

/* ---------- HERO ---------- */
.hero { padding: 76px 0 44px; text-align: center; }
.hero h1 { font-size: 2.5rem; letter-spacing: -0.02em; margin-bottom: 12px; color: var(--text); }
.hero p { color: var(--text-dim); max-width: 640px; margin: 0 auto 28px; font-size: 1.02rem; }

/* ---------- KARTY ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }

/* ---------- TARIFY + OPRAVA RADIO BUTTONU ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin: 40px 0; }

.plan-card {
    background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
    padding: 26px; display: flex; flex-direction: column; gap: 10px; position: relative;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.plan-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.plan-card.free { border-color: var(--green); }

.plan-card input[type="radio"] {
    position: absolute; top: 18px; right: 18px; width: 22px; height: 22px; margin: 0;
    -webkit-appearance: none; appearance: none;
    border: 2px solid var(--border-light); border-radius: 50%;
    background: var(--card); cursor: pointer; transition: all .15s ease;
}
.plan-card input[type="radio"]:checked {
    border-color: var(--accent); background: var(--accent);
    box-shadow: inset 0 0 0 4px var(--card);
}
.plan-card:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,109,240,0.15), var(--shadow);
}

.plan-card .badge {
    position: absolute; top: -11px; left: 16px;
    background: var(--green); color: #ffffff;
    font-size: 0.72rem; padding: 4px 11px; border-radius: 20px; font-weight: 700;
}

.plan-card h3 { margin: 4px 34px 0 0; font-size: 1.15rem; }
.plan-price { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.plan-price span { font-size: 0.82rem; color: var(--text-dim); font-weight: 400; }
.plan-specs { list-style: none; padding: 0; margin: 6px 0 10px; color: var(--text-dim); font-size: 0.9rem; }
.plan-specs li { padding: 3px 0; }
.plan-specs li::before { content: "✓ "; color: var(--green); font-weight: 700; }

/* ---------- FORMULÁŘE ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.88rem; color: var(--text-dim); font-weight: 500; }
.form-group input, .form-group select {
    width: 100%; padding: 11px 13px; background: #fbfcfe; border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem; font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,109,240,0.12); }
.form-group input::placeholder { color: var(--text-faint); }
.auth-wrap { max-width: 420px; margin: 60px auto; }

.alert { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.88rem; border: 1px solid transparent; }
.alert-error { background: var(--red-bg); color: #a3233a; border-color: rgba(224,51,79,.25); }
.alert-success { background: var(--green-bg); color: #0f7a50; border-color: rgba(31,169,113,.25); }
.alert-info { background: #eaefff; color: #3450c9; border-color: rgba(79,109,240,.25); }

/* ---------- DASHBOARD - výpis VM ---------- */
.vm-list { display: flex; flex-direction: column; gap: 10px; }
.vm-row-link { display: block; color: inherit; }
.vm-row {
    display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 22px; transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.vm-row:hover { background: var(--card-hover); border-color: var(--border-light); transform: translateX(2px); box-shadow: var(--shadow); }
.vm-row .vm-name { font-weight: 700; font-size: 1.05rem; flex: 1 1 160px; min-width: 0; color: var(--text); }
.vm-row .vm-quick-meta { color: var(--text-dim); font-size: 0.88rem; display: flex; gap: 18px; flex-wrap: wrap; flex: 2 1 300px; }
.vm-row .vm-status-label { text-transform: capitalize; }
.vm-row .vm-arrow { color: var(--text-faint); font-size: 1.2rem; flex-shrink: 0; transition: transform .15s ease; }
.vm-row-link:hover .vm-arrow { transform: translateX(3px); color: var(--accent); }

/* ---------- DETAIL VM ---------- */
.back-link { display: inline-block; margin-bottom: 18px; color: var(--text-dim); font-size: 0.9rem; }
.back-link:hover { color: var(--accent); }

.vm-detail-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.head-plan-badge {
    margin-left: 12px; background: var(--bg); border: 1px solid var(--border-light); color: var(--text-dim);
    font-size: 0.78rem; padding: 4px 10px; border-radius: 20px; font-weight: 600; vertical-align: middle;
}
.vm-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- ZÁLOŽKY ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab-btn {
    padding: 12px 20px; background: transparent; border: none; color: var(--text-dim) !important;
    font-weight: 600; font-size: 0.95rem; cursor: pointer; border-bottom: 2px solid transparent;
    white-space: nowrap; transition: color .15s ease, border-color .15s ease;
}
.tab-btn:hover { color: var(--text) !important; }
.tab-btn.active { color: var(--accent) !important; border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- PŘEHLEDOVÉ KARTY ---------- */
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }

.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; min-height: 90px; }
.stat-card-sm { padding: 16px 18px; min-height: 70px; }
.stat-card-label { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; font-weight: 600; }
.stat-card-value { font-size: 1.25rem; font-weight: 700; color: var(--text); word-break: break-word; }
.stat-card-value code { background: transparent; padding: 0; color: var(--text); font-family: "SF Mono", Consolas, monospace; font-size: 1rem; }
.stat-card-sub { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.code-block {
    background: #1a1d29; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 16px 18px; font-family: "SF Mono", Consolas, monospace; font-size: 0.88rem;
    color: #d7dbe8; overflow-x: auto; margin: 0;
}

.hint-text { color: var(--text-faint); font-size: 0.85rem; margin: 12px 0 0; }

/* ---------- GRAFY ---------- */
.graphs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.graph-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; }
.gauge-label { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 8px; }
.gauge-label span { color: var(--text); font-weight: 700; }
.gauge { background: #e9edf6; border: 1px solid var(--border); border-radius: 999px; height: 10px; overflow: hidden; margin-bottom: 10px; }
.gauge-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 999px; width: 0%; transition: width .5s ease; }
.sparkline { width: 100%; height: 70px; display: block; }

/* ---------- ISO ---------- */
.iso-panel-title { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 14px; font-weight: 600; }
.iso-select-row { display: flex; gap: 10px; flex-wrap: wrap; }
.iso-select-row select { flex: 1; min-width: 200px; background: #fbfcfe; color: var(--text); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 11px 13px; }

/* ---------- STATUS INDIKÁTORY ---------- */
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }
.status-running { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.status-stopped { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.status-provisioning, .status-failed { background: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-bg); }
.status-unknown { background: var(--text-faint); }

/* ---------- TABULKY (admin) ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th, table.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.data-table th { color: var(--text-dim); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.data-table tbody tr:hover { background: var(--card-hover); }

footer.site-footer { text-align: center; padding: 44px 0; color: var(--text-faint); font-size: 0.84rem; }

/* ---------- ADMIN ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: var(--bg-alt); border-right: 1px solid var(--border); padding: 22px 0; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 11px 24px; color: var(--text-dim); font-size: 0.92rem; font-weight: 500; border-left: 3px solid transparent; }
.admin-sidebar a:hover { color: var(--text); background: var(--card-hover); }
.admin-sidebar a.active { color: var(--accent); background: var(--card-hover); border-left-color: var(--accent); }
.admin-content { flex: 1; padding: 30px; max-width: 1200px; background: var(--bg); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-box .num { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.stat-box .label { color: var(--text-dim); font-size: 0.84rem; margin-top: 2px; }

@media (max-width: 820px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px; }
    .admin-sidebar a { padding: 8px 14px; white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
    .admin-sidebar a.active { border-left: none; border-bottom-color: var(--accent); }
}

@media (max-width: 720px) {
    nav.main-nav {
        position: fixed; top: 61px; left: 0; right: 0;
        background: var(--topbar-bg); flex-direction: column; align-items: flex-start;
        padding: 16px 20px; border-bottom: 1px solid var(--border); display: none; gap: 14px; box-shadow: var(--shadow);
    }
    nav.main-nav.open { display: flex; }
    .menu-toggle { display: block; }
    .theme-toggle-btn { margin-top: 10px; }
    .hero h1 { font-size: 1.8rem; }
    .plans-grid { grid-template-columns: 1fr; }
    .vm-row { flex-wrap: wrap; }
    .vm-row .vm-quick-meta { order: 3; flex-basis: 100%; }
    .vm-detail-head { flex-direction: column; align-items: flex-start; }
    .tabs { gap: 0; }
}
