/* =============================================================================
   grafika.css — Moderní světlý styl (sdílený pro admin moduly)
   ============================================================================= */

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

/* === RESET & PROMĚNNÉ ======================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:          #f0f4f8;
    --surface:     #ffffff;
    --surface2:    #f8fafc;
    --border:      #e2e8f0;
    --border2:     #cbd5e1;
    --accent:      #6366f1;
    --accent2:     #8b5cf6;
    --accent-dk:   #4f46e5;
    --text:        #0f172a;
    --muted:       #475569;
    --dim:         #94a3b8;
    --green:       #059669;
    --red:         #dc2626;
    --yellow:      #d97706;
    --orange:      #ea580c;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:   0 4px 12px rgba(0,0,0,.09);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
    --radius:      10px;
    --radius-lg:   14px;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* === HEADER ================================================================= */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    gap: 12px;
}

.header-left  { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.header-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
    flex-shrink: 0;
}

.header h1 {
    font-size: 16px; font-weight: 700;
    color: var(--text); white-space: nowrap;
}

.header-sub { font-size: 11px; color: var(--dim); }

/* === CONTAINER ============================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.container-sm {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* === TLAČÍTKA =============================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: transform .12s, box-shadow .12s, background .12s, opacity .12s, border-color .12s;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: .01em;
    line-height: 1;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled {
    opacity: .4; cursor: not-allowed;
    transform: none; pointer-events: none;
}
.btn svg { flex-shrink: 0; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    box-shadow: 0 3px 10px rgba(99,102,241,.28);
}
.btn-primary:hover { box-shadow: 0 5px 16px rgba(99,102,241,.42); }

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    box-shadow: 0 3px 10px rgba(5,150,105,.22);
}
.btn-success:hover { box-shadow: 0 5px 16px rgba(5,150,105,.38); }

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 3px 10px rgba(220,38,38,.22);
}
.btn-danger:hover { box-shadow: 0 5px 16px rgba(220,38,38,.38); }

.btn-secondary {
    background: var(--surface2);
    color: var(--muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface); color: var(--text);
    border-color: var(--border2);
}

.btn-ghost {
    background: transparent; color: var(--muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--surface2); color: var(--text);
    border-color: var(--border2);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    box-shadow: 0 3px 10px rgba(14,165,233,.22);
}
.btn-info:hover { box-shadow: 0 5px 16px rgba(14,165,233,.38); }

.btn-orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 3px 10px rgba(245,158,11,.22);
}
.btn-orange:hover { box-shadow: 0 5px 16px rgba(245,158,11,.38); }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; border-radius: 7px; }

/* === KARTY ================================================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}

.card-title {
    font-size: 14px; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 20px; }

/* === FORMULÁŘE ============================================================= */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--muted); margin-bottom: 6px;
}

.form-inline {
    display: flex; gap: 8px; align-items: center;
}
.form-inline .inp { flex: 1; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea, select {
    width: 100%; padding: 9px 12px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: 14px; font-family: inherit; outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

/* === SEZNAM STRÁNEK ========================================================= */
.pages-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.page-item {
    padding: 11px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    transition: background .1s;
    gap: 12px;
}
.page-item:last-child { border-bottom: none; }
.page-item:hover { background: var(--surface2); }
.page-item.indent-1 { padding-left: 42px; }
.page-item.indent-2 { padding-left: 66px; }

.page-info h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.page-info small { font-size: 11px; color: var(--dim); }

.page-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

/* === NOVÁ STRÁNKA =========================================================== */
.new-page-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.new-page-card h2 {
    font-size: 14px; font-weight: 700; color: var(--text);
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}

/* === ZÁLOHY ================================================================= */
.backup-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-top: 28px;
}

.backup-section h2 {
    font-size: 14px; font-weight: 700; color: var(--text);
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

.backup-list { margin-top: 12px; }

.backup-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    margin-bottom: 8px;
    gap: 12px;
    transition: border-color .12s;
}
.backup-item:hover { border-color: var(--border2); }

.backup-item-info { flex: 1; min-width: 0; }
.backup-item-time { font-size: 13px; font-weight: 600; color: var(--text); }
.backup-item-meta { font-size: 11px; color: var(--dim); margin-top: 2px; }

.backup-item-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* === FILE GRID ============================================================== */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.file-item {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    transition: border-color .15s, box-shadow .15s, transform .15s;
    position: relative;
}
.file-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(99,102,241,.12);
    transform: translateY(-2px);
}
.file-item.folder {
    background: #f0f4ff; border-color: #c7d2fe; cursor: pointer;
}
.file-item.folder:hover { border-color: var(--accent); background: #e0e7ff; }
.file-item.back-item   { background: #fefce8; border-color: #fde68a; cursor: pointer; }
.file-item.back-item:hover { border-color: #f59e0b; background: #fef9c3; }

.file-icon {
    display: flex; align-items: center; justify-content: center;
    height: 56px; margin-bottom: 10px; color: var(--muted); opacity: .6;
}

.file-name {
    font-size: 12px; word-break: break-word;
    margin-bottom: 6px; font-weight: 500; color: var(--text); line-height: 1.4;
}

.file-size { font-size: 11px; color: var(--dim); margin-bottom: 8px; }

.file-actions {
    display: flex; gap: 3px; justify-content: center;
    padding: 5px 2px 2px; flex-wrap: wrap;
}

.thumb-preview {
    width: 100%; height: 130px; object-fit: cover;
    border-radius: 6px; margin-bottom: 8px; display: block;
}

.video-preview {
    width: 100%; height: 130px; object-fit: cover;
    border-radius: 6px; margin-bottom: 8px; display: block; background: #000;
}

/* === BREADCRUMBS ============================================================ */
.breadcrumbs {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 11px 16px;
    margin-bottom: 18px;
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
    font-size: 13px; box-shadow: var(--shadow);
}
.breadcrumbs a { color: var(--accent); text-decoration: none; font-weight: 500; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumb-separator { color: var(--dim); }
.breadcrumb-current  { font-weight: 600; color: var(--text); }

/* === TOOLBAR BAR (nástrojová lišta správce souborů) ======================== */
.toolbar-bar {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 11px 14px;
    margin-bottom: 18px;
    display: flex; gap: 8px; flex-wrap: wrap;
    box-shadow: var(--shadow);
}

/* === UPLOAD PLOCHA ========================================================== */
.upload-area {
    background: var(--surface);
    border: 2px dashed var(--border2);
    border-radius: var(--radius-lg);
    padding: 34px; text-align: center;
    transition: border-color .2s, background .2s;
    margin-bottom: 18px; cursor: pointer;
}
.upload-area:hover,
.upload-area.drag-over { border-color: var(--accent); background: #f5f3ff; }
.upload-area input[type="file"] { display: none; }

.upload-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 13px; color: #fff;
    box-shadow: 0 4px 14px rgba(99,102,241,.28);
}
.upload-text { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--dim); }

/* === PROGRESS BAR =========================================================== */
.progress-bar {
    width: 100%; height: 8px;
    background: var(--border); border-radius: 99px;
    overflow: hidden; margin-top: 14px; display: none;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    width: 0%; transition: width .3s; border-radius: 99px;
}

/* === ALERTOVÉ ZPRÁVY ======================================================== */
.alert {
    padding: 11px 15px; border-radius: 8px;
    margin-bottom: 14px; font-weight: 500; font-size: 13px;
    animation: slideIn .22s ease;
    display: flex; align-items: center; gap: 8px;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

#alertContainer {
    position: fixed; top: 20px; right: 20px;
    z-index: 9999; max-width: 360px; pointer-events: none;
}
#alertContainer .alert {
    pointer-events: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* === STATISTIKY ============================================================= */
.stats-bar {
    display: flex; gap: 16px; margin-bottom: 14px;
    font-size: 13px; color: var(--muted); flex-wrap: wrap;
}
.stats-bar strong { color: var(--text); }

/* === PRÁZDNÝ STAV =========================================================== */
.empty-state {
    text-align: center; padding: 56px 20px; color: var(--dim);
}
.empty-state-icon {
    display: flex; align-items: center; justify-content: center;
    width: 60px; height: 60px; margin: 0 auto 14px; opacity: .3;
}
.empty-state p { font-size: 14px; font-weight: 500; }

/* === MODÁLNÍ OKNA =========================================================== */
.modal {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.38); z-index: 1000;
    overflow-y: auto; padding: 20px;
    backdrop-filter: blur(3px);
}
.modal.show {
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 26px;
    max-width: 480px; width: 100%;
    box-shadow: var(--shadow-lg);
}
.modal-content h2 {
    font-size: 16px; font-weight: 700; color: var(--text);
    margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.modal-buttons { display: flex; gap: 8px; margin-top: 18px; }
.modal-buttons .btn { flex: 1; justify-content: center; }

/* === PŘIHLAŠOVACÍ STRÁNKA =================================================== */
.login-wrapper {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center; padding: 20px;
}
.login-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 42px 34px;
    width: 100%; max-width: 390px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    display: flex; align-items: center; gap: 13px; margin-bottom: 26px;
}
.login-logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.3); flex-shrink: 0;
}
.login-logo-text { font-size: 18px; font-weight: 800; color: var(--text); }
.login-logo-sub  { font-size: 12px; color: var(--dim); margin-top: 1px; }
.login-card h2   { font-size: 21px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.login-subtitle  { font-size: 13px; color: var(--dim); margin-bottom: 24px; }

.btn-login {
    width: 100%; justify-content: center;
    padding: 12px; font-size: 15px; margin-top: 6px;
}

.install-note {
    background: #eff6ff; color: #1e40af;
    border: 1px solid #bfdbfe; border-left: 3px solid var(--accent);
    padding: 11px 14px; border-radius: 8px;
    font-size: 13px; margin-bottom: 18px;
}

/* === EDITOR STRÁNKY (edit.php) ============================================== */
.editor-wrapper { max-width: 1350px; margin: 0 auto; padding: 24px 20px; }

.editor-toolbar {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 7px 10px;
    border-radius: 10px 10px 0 0;
    display: flex; gap: 3px; flex-wrap: wrap; align-items: center;
    position: sticky; top: 60px; z-index: 90;
    transition: box-shadow .2s;
}
.editor-toolbar.stuck {
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.editor-toolbar button {
    background: var(--surface); border: 1px solid var(--border);
    padding: 4px 7px; cursor: pointer; border-radius: 5px;
    font-size: 12px; min-width: 28px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .12s; color: var(--muted); font-family: inherit;
    font-weight: 600;
}
.editor-toolbar button:hover {
    background: var(--surface2); border-color: var(--border2); color: var(--text);
}
.editor-toolbar button:active { background: #ede9fe; }
.editor-toolbar button:disabled { opacity: .3; cursor: not-allowed; }
.editor-toolbar button.active {
    background: #ede9fe; color: var(--accent); border-color: #c4b5fd;
}
.editor-toolbar .separator {
    width: 1px; background: var(--border); height: 20px; margin: 0 4px;
}

#editor {
    min-height: 420px; padding: 22px;
    border: 1px solid var(--border); border-radius: 0 0 10px 10px;
    outline: none; overflow-y: auto; background: var(--surface);
    font-size: 15px; line-height: 1.7; color: var(--text);
}
#editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.08); }
#editor table { border-collapse: collapse; width: 100%; margin: 10px 0; }
#editor table td, #editor table th { border: 1px solid var(--border); padding: 8px; min-width: 50px; }
#editor table th { background: var(--surface2); font-weight: 700; }

#htmlEditor {
    width: 100%; min-height: 420px; padding: 20px;
    border: 1px solid var(--border); font-family: 'Courier New', monospace;
    font-size: 13px; resize: vertical; border-radius: 0 0 10px 10px;
    background: #1e293b; color: #7dd3fc;
}

.color-picker {
    position: fixed; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 11px; box-shadow: var(--shadow-md); z-index: 1001; display: none;
}
.color-picker.show { display: block; }
.color-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 5px; }
.color-option {
    width: 34px; height: 34px; border: 2px solid transparent;
    border-radius: 6px; cursor: pointer; transition: all .12s;
}
.color-option:hover { border-color: var(--text); transform: scale(1.1); }

.saved-msg { color: var(--green); font-size: 13px; font-weight: 600;
             display: flex; align-items: center; gap: 5px; }

/* === KONTEJNERY SOUBORŮ / GALERIÍ =========================================== */
.files-container,
.galleries-container {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px;
    box-shadow: var(--shadow);
}

/* === UTILITY ================================================================ */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-dim   { color: var(--dim); }
.text-accent { color: var(--accent); }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 12px; }
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; }  .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* === RESPONZIVITA ============================================================ */
@media (max-width: 768px) {
    .header { padding: 0 14px; }
    .container, .container-sm { padding: 14px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .header h1 { font-size: 14px; }
    .page-actions { flex-wrap: wrap; gap: 3px; }
}
