:root {
    --bg:        #1b1f24;   /* tmavě šedé pozadí */
    --bg2:       #1f242a;   /* karty, plochy */
    --bg3:       #252b31;   /* vstupy, chipy */
    --border:    #2c3238;
    --border2:   #3a444d;   /* zvýraznění / hover */
    --text:      #e9edf1;
    --text-muted:#8b9298;
    --text-dim:  #6b7177;

    --accent:       #1076b7;  /* firemní modrá */
    --accent-hover: #0f5885;  /* tmavá modrá */
    --accent-soft:  #13344d;  /* tlumené modré pozadí */
    --accent-text:  #6bb3e6;  /* světlá modrá na text/akcenty */

    --info-bg:   #2a4a4f;     /* petrolejová pro kredity / cenu */
    --info-text: #9fd8d2;

    --success: #3ba776;
    --error:   #d35f5f;
    --radius:  10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* LOGIN */
.login-page { display: flex; align-items: center; justify-content: center; }

.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    margin: 40px 16px;
}

.login-box h1 { font-size: 28px; font-weight: 600; margin-bottom: 6px; }
.subtitle { color: var(--text-muted); margin-bottom: 28px; }

.login-note {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-dim);
    text-align: center;
}
.login-note a { color: var(--accent-text); text-decoration: none; }
.login-note a:hover { text-decoration: underline; }

/* HEADER */
header {
    background: #15191d;
    border-bottom: 1px solid var(--border);
    padding: 0 22px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.logo .arrow { color: var(--accent-text); }

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.user-info a { color: var(--text-muted); text-decoration: none; }
.user-info a:hover { color: var(--text); }

/* SVG ikony dědí barvu a zarovnají se na střed */
.header-action svg, .credits svg, .btn-primary svg, .btn-secondary svg { display: block; }

/* mobil: odlehčíme lištu */
@media (max-width: 600px) {
    header { padding: 0 14px; }
    .user-info { gap: 10px; }
    .hide-mobile { display: none; }
}

/* lišta: novinky + nahlásit chybu */
.header-action {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    position: relative;
    padding: 0;
}
.header-action:hover { color: var(--text); }

.credits {
    background: var(--info-bg);
    color: var(--info-text);
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* odznak nepřečtených novinek */
.news-dot {
    position: absolute;
    top: -3px; right: -4px;
    width: 7px; height: 7px;
    background: var(--accent);
    border-radius: 50%;
}

/* panel novinek */
.news-panel {
    position: absolute;
    top: 52px; right: 16px;
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 8px;
    z-index: 20;
    display: none;
}
.news-panel.open { display: block; }
.news-item { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-item .date { font-size: 11px; color: var(--text-dim); }
.news-item .title { font-size: 14px; font-weight: 500; color: var(--text); margin: 2px 0 4px; }
.news-item .text { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.news-empty { padding: 16px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* MAIN */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 18px;
}

main h2 { font-size: 21px; font-weight: 500; margin-bottom: 22px; }

.title-row { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; flex-wrap: wrap; }
.title-row h2 { margin: 0; }

.cost-pill {
    background: var(--info-bg);
    color: var(--info-text);
    font-size: 12px;
    padding: 4px 11px;
    border-radius: 6px;
}

/* WORKFLOW GRID (dashboard) */
.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.workflow-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.workflow-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.workflow-card h3 { font-size: 17px; font-weight: 500; }
.workflow-card p { color: var(--text-muted); font-size: 14px; flex: 1; }

/* ===== WORKFLOW: dvousloupcový layout ===== */
.workflow-main { max-width: 1000px; }

.wf-layout {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 760px) {
    .wf-layout { grid-template-columns: 1fr; }
}

/* Šablona bez vstupní fotky (např. text→obrázek) — jeden sloupec */
.wf-layout.wf-single { grid-template-columns: 1fr; max-width: 640px; }

.wf-block { margin-bottom: 18px; }
.wf-block h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}
.wf-block h3 .num { color: var(--accent-text); margin-right: 4px; }
.wf-block p.hint { color: var(--text-muted); font-size: 13px; margin-bottom: 10px; }

.wf-settings {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.wf-settings .form-group { margin: 0; }

/* výsledek na celou šířku, vycentrovaný (drží výšku i šířku videa) */
.wf-result {
    border-top: 1px solid var(--border);
    margin-top: 20px;
    padding-top: 18px;
}
.wf-result h3 { font-size: 14px; font-weight: 500; text-align: center; margin-bottom: 12px; }
.wf-result-box {
    background: #15191d;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.wf-result-box video,
.wf-result-box img {
    max-width: 100%;
    max-height: 460px;
    border-radius: 8px;
    display: block;
}
.wf-result-actions { text-align: center; margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* UPLOAD */
.upload-area {
    border: 1.5px dashed var(--border2);
    border-radius: var(--radius);
    padding: 30px 18px;
    text-align: center;
    cursor: pointer;
    background: var(--bg2);
    transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent);
    background: rgba(16, 118, 183, 0.06);
}
.upload-icon { font-size: 30px; display: block; margin-bottom: 8px; color: var(--accent); }

/* TEXTAREA */
textarea {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 11px 13px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.55;
    transition: border-color 0.2s;
}
textarea:focus { outline: none; border-color: var(--accent); }

/* PROMPT EXAMPLES */
.prompt-examples { margin-top: 10px; }
.examples-label { font-size: 14px; color: var(--text-muted); margin-bottom: 6px; }
.example-prompt {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 13px;
    line-height: 19px;
    height: 46px;                /* 2 řádky (38px) + padding (8px) */
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 5px;
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color 0.2s, color 0.2s;
}
.example-prompt:hover { border-color: var(--accent); color: var(--text); }

/* PROGRESS */
.progress-bar { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; margin: 14px 0 8px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.5s ease; width: 0%; }
#progressText { font-size: 14px; color: var(--text-muted); }
.progress-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; color: var(--text-muted); margin-bottom: 5px; }

input[type="text"], input[type="password"], input[type="number"], select {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 9px 12px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
input[type="text"], input[type="password"] { width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--accent); }

input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* BUTTONS */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 11px 20px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-large { padding: 13px 24px; font-size: 15px; width: 100%; }
.btn-small { padding: 5px 12px; font-size: 13px; }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 9px 16px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 5px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-danger:hover { background: rgba(211, 95, 95, 0.1); }

.btn-toggle { background: none; border: none; cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: 4px; transition: background 0.2s; }
.btn-toggle:hover { background: var(--bg3); }

/* MESSAGES */
.error {
    background: rgba(211, 95, 95, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.success {
    background: rgba(59, 167, 118, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.empty { color: var(--text-muted); }

.empty-box {
    background: var(--bg2);
    border: 1px dashed var(--border2);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 36px;
}

/* Kontaktní výzva pod „Vaše šablony" */
.contact-line {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.empty-box .contact-line { justify-content: center; margin-top: 14px; }

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}
.contact-item svg { color: var(--text-muted); flex-shrink: 0; }
a.contact-item:hover { color: var(--accent-text); text-decoration: underline; }

/* Kontaktní karta na konci mřížky šablon (stejný styl jako šablona) */
.contact-card { cursor: default; }
.contact-card:hover { transform: none; border-color: var(--border); }
.contact-card .contact-line { margin-top: auto; padding-top: 4px; }

/* MODAL (nahlásit chybu) */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 22px;
    width: 100%;
    max-width: 440px;
}
.modal h3 { font-size: 16px; font-weight: 500; margin-bottom: 6px; }
.modal p { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.modal textarea { min-height: 110px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ADMIN */
.admin-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.admin-card h3 { font-size: 16px; margin-bottom: 16px; font-weight: 500; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1; min-width: 120px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 8px 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 500; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: none; }
