* {
    box-sizing: border-box;
}

:root {
    --club-blue: #0033a0;
    --club-blue-light: #e8eefc;
    --club-blue-hover: #002580;
    --club-red: #dc143c;
    --ink: #1a1d26;
    --muted: #6b7280;
    --line: #e5e7eb;
    --panel: #ffffff;
    --page: #f0f4fa;
    --surface: #f7f9fd;
    --success: #059669;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ink);
    background:
        linear-gradient(160deg, rgba(0, 51, 160, 0.06) 0%, transparent 50%),
        linear-gradient(320deg, rgba(220, 20, 60, 0.04) 0%, transparent 50%),
        var(--page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
select {
    font: inherit;
}

/* ── Shell ── */

.upload-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 48px 20px;
}

/* ── Panels ── */

.upload-panel {
    width: min(960px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px;
}

.upload-panel[hidden] {
    display: none;
}

.login-panel {
    width: min(560px, 100%);
}

.panel-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.signed-in-label {
    color: var(--club-blue);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Heading ── */

.upload-heading {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 28px;
    align-items: center;
    margin-bottom: 40px;
}

.upload-logo {
    width: 80px;
    height: 96px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 51, 160, 0.15));
}

.eyebrow {
    color: var(--club-red);
    font-weight: 700;
    font-size: 0.8rem;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 {
    margin: 0 0 10px;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.upload-heading p:last-child {
    color: var(--muted);
    margin: 0;
    max-width: 660px;
    line-height: 1.6;
}

/* ── Forms ── */

.login-form,
.upload-form {
    display: grid;
    gap: 28px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.field {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.9rem;
}

.field input,
.field select {
    width: 100%;
    min-height: 48px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 0 16px;
    color: var(--ink);
    background: var(--panel);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.field input::placeholder {
    color: #9ca3af;
}

.field input:hover,
.field select:hover {
    border-color: #c5ccd8;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--club-blue);
    box-shadow: 0 0 0 4px rgba(0, 51, 160, 0.1);
}

/* ── Folder browser ── */

.folder-browser {
    display: grid;
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.folder-browser-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.folder-browser h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.folder-browser p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.folder-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.folder-nav-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--club-blue);
}

.folder-back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    padding: 0;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition);
}

.folder-back-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.folder-back-button[hidden] {
    display: none;
}

.current-folder {
    flex: 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    letter-spacing: 0.01em;
    overflow-wrap: anywhere;
}

.button-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.create-folder-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
}

.folder-grid {
    display: grid;
    gap: 2px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--line);
}

.folder-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    border: 0;
    background: var(--panel);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.folder-row:hover {
    background: var(--club-blue-light);
}

.folder-row:active,
.folder-row.is-loading {
    background: #dbe4fc;
}

.folder-row-icon {
    display: flex;
    align-items: center;
    color: var(--club-blue);
    opacity: 0.7;
}

.folder-row:hover .folder-row-icon {
    opacity: 1;
}

.folder-row-name {
    font-weight: 600;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.folder-row-arrow {
    display: flex;
    align-items: center;
    color: var(--muted);
    opacity: 0;
    transition: opacity var(--transition), transform var(--transition);
}

.folder-row:hover .folder-row-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.folder-row.is-loading .folder-row-arrow {
    opacity: 1;
    animation: pulse-arrow 0.8s ease-in-out infinite alternate;
}

@keyframes pulse-arrow {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.empty-state {
    padding: 24px 20px;
    border: 1.5px dashed #d1d5db;
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--panel);
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
}

.folder-grid .empty-state {
    border: 0;
    border-radius: 0;
}

/* ── Image grid ── */

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.image-card {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--panel);
    transition: box-shadow var(--transition), transform var(--transition);
}

.image-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.image-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.image-card p {
    margin: 0;
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Drop zone ── */

.drop-zone {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 36px;
    border: 2px dashed #c5cfe6;
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition), transform var(--transition);
}

.drop-zone:hover {
    border-color: #94a8d0;
    background: #f0f4ff;
}

.drop-zone.is-active {
    border-color: var(--club-blue);
    background: #e8eefc;
    transform: scale(1.01);
}

.drop-zone input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.drop-zone-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.drop-zone-copy {
    color: var(--club-blue);
    font-weight: 600;
    font-size: 0.95rem;
}

.drop-zone-note {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 4px;
}

/* ── Buttons ── */

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.button {
    border: 0;
    border-radius: var(--radius);
    padding: 14px 24px;
    background: var(--club-blue);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.button:hover {
    background: var(--club-blue-hover);
    box-shadow: 0 4px 12px rgba(0, 51, 160, 0.25);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
    box-shadow: none;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
    box-shadow: none;
}

.button-secondary {
    color: var(--club-blue);
    background: var(--club-blue-light);
}

.button-secondary:hover {
    background: #dbe4fc;
    box-shadow: 0 4px 12px rgba(0, 51, 160, 0.1);
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 0;
    transition: color var(--transition);
}

.text-button:hover {
    color: var(--club-red);
}

/* ── Status ── */

.status {
    min-height: 24px;
    margin-top: 24px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.status:empty {
    padding: 0;
    margin-top: 0;
}

.status.is-success {
    color: var(--success);
    background: var(--success-bg);
}

.status.is-error {
    color: var(--error);
    background: var(--error-bg);
}

/* ── File list ── */

.file-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.file-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color var(--transition);
}

.file-item:hover {
    border-color: #c5ccd8;
}

.file-name {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.file-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.file-state {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.file-state.is-success {
    color: var(--success);
}

.file-state.is-error {
    color: var(--error);
}

/* ── Admin Tabs ── */

.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--line);
}

.admin-tab {
    border: 0;
    background: transparent;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}

.admin-tab:hover {
    color: var(--ink);
}

.admin-tab.is-active {
    color: var(--club-blue);
    border-bottom-color: var(--club-blue);
}

/* ── Matches Tab ── */

.matches-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.matches-toolbar h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.matches-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.category-filter-select {
    min-height: 44px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 0 14px;
    color: var(--ink);
    background: var(--panel);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

.category-filter-select:hover {
    border-color: #c5ccd8;
}

.category-filter-select:focus {
    outline: none;
    border-color: var(--club-blue);
    box-shadow: 0 0 0 4px rgba(0, 51, 160, 0.1);
}

.match-list {
    display: grid;
    gap: 10px;
}

.match-list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color var(--transition);
}

.match-list-card:hover {
    border-color: #c5ccd8;
}

.match-list-date {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.match-list-teams {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
}

.match-list-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.match-list-category {
    font-size: 0.8rem;
    color: var(--club-blue);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.match-list-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.match-list-badge.is-upcoming {
    background: #fef3c7;
    color: #92400e;
}

.match-list-badge.is-played {
    background: var(--success-bg);
    color: var(--success);
}

.match-list-score {
    font-weight: 800;
    font-size: 1rem;
    color: var(--club-blue);
}

.match-list-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Match Form ── */

.match-form-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    background: var(--surface);
}

.match-form-panel h3 {
    margin: 0 0 24px;
    font-size: 1.2rem;
    font-weight: 700;
}

.match-form-panel h4 {
    margin: 20px 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--club-blue);
}

.match-form {
    display: grid;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.score-section {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.dynamic-rows {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
}

.dynamic-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dynamic-row input {
    min-height: 40px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 0 12px;
    font: inherit;
    color: var(--ink);
    background: var(--panel);
}

.dynamic-row input.gs-name {
    flex: 3;
}

.dynamic-row input.gs-time {
    flex: 1;
    max-width: 80px;
}

.button-danger {
    color: #fff;
    background: var(--error);
}

.button-danger:hover {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.remove-row-btn {
    padding: 8px 12px !important;
    min-height: 40px;
}

/* ── Responsive ── */

@media (max-width: 700px) {
    .upload-shell {
        padding: 24px 12px;
    }

    .upload-panel {
        padding: 28px 20px;
    }

    .upload-heading {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 16px;
        margin-bottom: 32px;
    }

    .upload-logo {
        width: 64px;
        height: 76px;
        margin: 0 auto;
    }

    .field-grid,
    .create-folder-row {
        grid-template-columns: 1fr;
    }

    .folder-browser-head {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .file-item,
    .match-list-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .match-list-card {
        flex-direction: column;
        align-items: stretch;
    }

    .match-list-actions {
        justify-content: flex-end;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .file-state {
        grid-column: 1;
    }

    .drop-zone {
        min-height: 180px;
        padding: 24px 16px;
    }

    .folder-row {
        padding: 12px 14px;
    }
}

/* ===========================================================
   Admin generic styles (used by Aktuality, Hráči tabs)
   =========================================================== */

.admin-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 24px 0 12px;
    color: var(--ink, #0f172a);
}

.admin-note {
    background: #f5f6f8;
    border-left: 3px solid #94a3b8;
    padding: 12px 14px;
    margin: 8px 0 16px;
    font-size: 0.92rem;
    color: #475569;
    border-radius: 6px;
}

.admin-list-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 18px;
    flex-wrap: wrap;
}
.admin-list-toolbar .field {
    flex: 1 1 220px;
    max-width: 320px;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-list-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-list-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.admin-list-info {
    flex: 1;
    min-width: 0;
}
.admin-list-primary {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}
.admin-list-secondary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 4px;
}
.admin-list-tertiary {
    font-size: 0.78rem;
    color: #94a3b8;
    font-family: ui-monospace, Menlo, monospace;
}

.admin-list-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
}
.admin-list-tag.is-keeper {
    background: #fef3c7;
    color: #92400e;
}

.admin-list-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.admin-form-panel {
    margin-top: 16px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 600px) {
    .admin-form-row {
        grid-template-columns: 1fr;
    }
    .admin-list-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-list-actions {
        width: 100%;
    }
    .admin-list-actions .button {
        flex: 1;
    }
}

.field-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: #475569;
}
.field-checkbox input {
    width: 16px;
    height: 16px;
}

.events-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin: 0;
}
.events-fieldset legend {
    padding: 0 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

/* Force [hidden] to win over .admin-list { display: flex } and similar */
[hidden] {
    display: none !important;
}

/* News form — textarea + preview pane */
#newsBody {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    font-family: ui-monospace, Menlo, monospace;
    font-size: 0.88rem;
    min-height: 280px;
    resize: vertical;
    background: #fafbfc;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.5;
}

.news-preview {
    margin-top: 24px;
    padding: 24px;
    background: #fff;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius);
}

.news-preview-content {
    color: #0f172a;
    line-height: 1.65;
}
.news-preview-content h2 {
    margin: 0 0 6px;
    font-size: 1.4rem;
}
.news-preview-content h3 {
    margin: 18px 0 8px;
    font-size: 1.1rem;
}
.news-preview-content h4 {
    margin: 14px 0 6px;
    font-size: 1rem;
}
.news-preview-content p { margin: 0 0 10px; }
.news-preview-content ul { margin: 6px 0 14px 20px; padding: 0; }
.news-preview-content img { max-width: 100%; border-radius: 8px; }
.news-preview-content .article-meta {
    color: #64748b;
    font-size: 0.85rem;
    font-style: italic;
    margin-bottom: 16px;
}

/* AI assistant block inside news form */
.ai-assistant {
    border: 1.5px solid #e0e7ff;
    background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 0;
}
.ai-assistant legend {
    padding: 0 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #5b21b6;
}
.ai-assistant textarea {
    background: #fff;
}
.ai-assistant .button {
    min-width: auto;
}
