:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
}

[data-bs-theme="light"] {
    --bg-body: #f1f5f9;
    --bg-navbar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --blue-glow: rgba(79, 70, 229, 0.1);
}

[data-bs-theme="dark"] {
    --bg-body: #0f172a;
    --bg-navbar: #1e293b;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --blue-glow: rgba(79, 70, 229, 0.2);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s;
}

.navbar {
    background-color: var(--bg-navbar) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
}

.navbar-brand h1 { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--text-main); }

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background-color: var(--blue-glow);
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.stat-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
.theme-toggle:hover { background: var(--blue-glow); }

/* Oko u polí type=password (theme.js: .password-wrapper + .password-toggle-toggle) */
.password-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.password-wrapper .form-control {
    padding-right: 2.75rem;
}

.password-toggle-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    z-index: 5;
    font-size: 1rem;
    line-height: 1;
    padding: 0.2rem;
}

.password-toggle-toggle:hover {
    color: var(--primary);
}

.welcome-banner {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid var(--border-color);
}

footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--bg-navbar);
    border-top: 1px solid var(--border-color);
    padding: 0.4rem 0;
    z-index: 1030;
    font-size: 0.75rem;
}

.system-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}
.system-badge span { display: flex; align-items: center; gap: 0.4rem; }

/* Aktivní filtr v reportech */
.active-filter {
    border-color: var(--primary) !important;
    background-color: var(--blue-glow) !important;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.1) !important;
}

/* Sticky filtry v reportech */
.sticky-filter {
    position: -webkit-sticky !important; /* Pro Safari */
    position: sticky !important;
    top: 65px !important; /* Musí odpovídat výšce navbaru */
    z-index: 1010;
    display: block !important;
}

/* Vynucení viditelnosti pro sticky chování */
body, html, main, .container-fluid {
    overflow: visible !important;
}

/* Lehký stín při scrollování pro lepší oddělení */
.sticky-filter .card {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
    background-color: var(--bg-card) !important;
}

/* Filtry reportu: na mobilu sbalitelné, na lg+ vždy rozbalené */
.niseo-filter-collapse-toggle {
    color: var(--bs-body-color, inherit);
    background-color: var(--bg-card) !important;
    --bs-btn-bg: var(--bg-card);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: var(--bs-secondary-bg);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: var(--bs-secondary-bg);
    --bs-btn-active-border-color: transparent;
}
.niseo-filter-collapse-toggle:hover {
    background-color: var(--bs-secondary-bg) !important;
}
.niseo-filter-collapse-toggle .niseo-filter-chevron {
    transition: transform 0.2s ease;
}
.niseo-filter-collapse-toggle:not(.collapsed) .niseo-filter-chevron {
    transform: rotate(180deg);
}
/* Poznámky ke skenu na reportu (sbalitelný blok) */
.niseo-scan-notes-toggle .niseo-scan-notes-chevron {
    transition: transform 0.2s ease;
}
.niseo-scan-notes-toggle:not(.collapsed) .niseo-scan-notes-chevron {
    transform: rotate(180deg);
}
.niseo-scan-notes-toggle {
    --bs-btn-bg: var(--bg-card);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: var(--bs-secondary-bg);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: var(--bs-secondary-bg);
    --bs-btn-active-border-color: transparent;
    background-color: var(--bg-card) !important;
}
.niseo-scan-notes-toggle:hover {
    background-color: var(--bs-secondary-bg) !important;
}
.scan-note-html-view a {
    word-break: break-word;
    overflow-wrap: anywhere;
}
@media (min-width: 992px) {
    .niseo-filter-collapse.collapse {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }
    .niseo-filter-collapse.collapsing {
        display: block !important;
        height: auto !important;
        transition: none !important;
    }
}

/* Plovoucí stránkování nad patičkou */
.sticky-pagination {
    position: fixed;
    bottom: 55px; /* Nad patičkou */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1040;
    background-color: var(--bg-card);
    padding: 6px 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: center;
}

[data-bs-theme="dark"] .sticky-pagination {
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/* Meta report (admin): hromadné akce vlevo dole — jen od lg, zobrazí JS při výběru řádků */
.niseo-meta-bulk-bar {
    position: fixed;
    bottom: 55px;
    left: 1rem;
    z-index: 1039;
    max-width: calc(100vw - 2rem);
    background-color: var(--bg-card);
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: none;
}

@media (min-width: 992px) {
    .niseo-meta-bulk-bar.is-visible {
        display: flex;
    }
}

[data-bs-theme="dark"] .niseo-meta-bulk-bar {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* Celostránkový loader při odeslání formuláře (GET filtry, přihlášení, …) */
.niseo-page-loader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.niseo-page-loader.is-visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.niseo-page-loader__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
}

[data-bs-theme="dark"] .niseo-page-loader__backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.niseo-page-loader__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.75rem 2rem;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.45s ease 0.08s, transform 0.45s ease 0.08s;
}

.niseo-page-loader.is-visible .niseo-page-loader__panel {
    opacity: 1;
    transform: scale(1);
}

.niseo-page-loader__spinner {
    width: 2.75rem;
    height: 2.75rem;
    border-width: 0.2rem;
    /* výchozí BS ~0,75 s — pomalejší rotace, lépe vidět na rychlém přenačtení */
    animation-duration: 1.35s;
}

.niseo-page-loader__label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Tooltip u badge strukturovaných dat (kliknutím; dlouhý JSON + scroll uvnitř) */
.tooltip.niseo-structured-tooltip {
    pointer-events: auto;
    max-width: min(96vw, 900px);
}

.tooltip.niseo-structured-tooltip .tooltip-inner {
    pointer-events: auto;
    max-width: min(96vw, 900px);
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.35;
    max-height: min(70vh, 28rem);
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.tooltip.niseo-structured-tooltip .structured-tooltip-body a {
    font-weight: 600;
}

.tooltip.niseo-structured-tooltip pre.structured-tooltip-json {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: inherit;
    line-height: inherit;
}

/* Structured data report: náhledy z JSON-LD (WebPage / Product) */
.niseo-structured-img-cell .niseo-structured-img-link {
    flex-shrink: 0;
    vertical-align: top;
}

.niseo-structured-thumb {
    display: block;
    object-fit: cover;
    background-color: var(--bs-secondary-bg);
}

.niseo-structured-thumb--sm {
    width: 48px;
    height: 48px;
}

/* Google Reviews: celý text recenze po kliknutí — barvy podle light/dark (proměnné tématu) */
.tooltip.niseo-review-snippet-tooltip {
    pointer-events: auto;
    max-width: min(96vw, 36rem);
    --bs-tooltip-bg: var(--bs-body-bg);
    --bs-tooltip-color: var(--bs-body-color);
}

.tooltip.niseo-review-snippet-tooltip .tooltip-inner {
    pointer-events: auto;
    max-width: min(96vw, 36rem);
    text-align: left;
    font-size: 0.875rem;
    line-height: 1.45;
    max-height: min(70vh, 28rem);
    overflow-y: auto;
    white-space: normal;
    word-break: break-word;
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--bs-box-shadow);
}

.tooltip.niseo-review-snippet-tooltip .niseo-review-snippet-tooltip-body {
    margin: 0;
}

/* Meta report: celý META DESC + zvýraznění duplicit */
.niseo-meta-seo-block {
    position: relative;
}

.niseo-meta-desc-full {
    word-break: break-word;
    max-width: 100%;
}

.niseo-meta-dup-frame {
    border: 1px solid rgba(var(--bs-danger-rgb), 0.45);
    border-radius: 0.5rem;
    padding: 0.45rem 2.35rem 0.45rem 0.6rem;
    margin-bottom: 0.35rem;
    background-color: rgba(var(--bs-danger-rgb), 0.06);
}

.niseo-meta-dup-badge {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 1;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1;
    padding: 0.25em 0.5em;
}

/* Meta report: slovní diff TITLE / META / H1 při porovnání skenů */
.niseo-meta-wdiff-wrap del.niseo-meta-wdiff {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    background-color: rgba(var(--bs-danger-rgb), 0.12);
    padding: 0.05em 0.15em;
    border-radius: 0.2em;
}

.niseo-meta-wdiff-wrap ins.niseo-meta-wdiff {
    text-decoration: none;
    background-color: rgba(var(--bs-success-rgb), 0.18);
    padding: 0.05em 0.15em;
    border-radius: 0.2em;
}

/* Karta se seznamem uživatelů — bez overflow:hidden, aby Tom Select dropdown (uvnitř formuláře) nebyl oříznutý */
.niseo-user-list-card {
    overflow: visible;
}

/* Přehled uživatelů: místo tabulky — grid na lg+, na mobilu pod sebou (lepší Tom Select v collapse) */
.niseo-user-row-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 992px) {
    .niseo-user-head,
    .niseo-user-row-inner {
        display: grid;
        grid-template-columns:
            minmax(9rem, 1.05fr)
            minmax(11rem, 1.75fr)
            5.25rem
            minmax(7.5rem, 1fr)
            minmax(7.5rem, 1fr)
            minmax(5rem, auto);
        gap: 0.75rem 1rem;
        align-items: start;
    }

    .niseo-user-col-actions {
        justify-self: end;
        text-align: end;
    }
}

/* Tom Select (správa uživatelů): dropdownParent = .niseo-user-domains-ts — nad sousedními řádky */
.niseo-user-domains-ts,
.niseo-user-clients-ts {
    position: relative;
    z-index: 0;
}

.niseo-user-domains-ts:focus-within,
.niseo-user-clients-ts:focus-within {
    z-index: 2;
}

.ts-dropdown {
    z-index: 1060;
}

.niseo-user-domains-ts .ts-wrapper,
.niseo-user-clients-ts .ts-wrapper {
    width: 100%;
}

.niseo-user-domains-ts .ts-control,
.niseo-user-clients-ts .ts-control {
    min-height: 2.75rem;
}

/* Viditelné místo pro vstup vedle štítků (multi; caret_position + remove_button) */
.niseo-user-domains-ts .ts-wrapper.multi .ts-control input,
.niseo-user-clients-ts .ts-wrapper.multi .ts-control input {
    flex: 1 1 10rem !important;
    min-width: 6rem !important;
    width: auto !important;
}
