/* Basic styling for Xservices IT */
html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden; /* prevence horizontálního posuvníku při modalech/tabulkách */
}

/* Bootstrap modaly: zabránění „poskakování“ layoutu a ořezávání dropdownů vlivem kompenzace scrollbarů */
body.modal-open {
    padding-right: 0 !important;
}

/* Pokud je otevřen modal, musíme zamknout i scroll na <html>.
   V projektu je totiž html { overflow-y: scroll; } kvůli stabilní šířce layoutu,
   což by jinak nechalo stránku pod modalem scrollovat.

   Pozn.: neřešíme to JSem (kvůli stabilitě). Moderní prohlížeče podporují :has().
   Fallback pokrývá Bootstrap (body.modal-open). */
html:has(.modal.show),
body:has(.modal.show) {
    overflow: hidden !important;
}

html {
    overflow-y: scroll; /* stabilní šířka stránky (bez posunu při otevření modalu) */
}

.hero {
    padding: 6rem 0 4rem 0;
}

.hero-gradient {
    background: radial-gradient(circle at top left, #0d6efd33, transparent 55%),
                radial-gradient(circle at bottom right, #19875433, transparent 55%);
}

.navbar-brand span {
    font-weight: 700;
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
}

.card-glass {
    backdrop-filter: blur(16px);
    background-color: rgba(255, 255, 255, 0.85);
}

footer {
    margin-top: auto; /* patička vždy u spodní hrany (flex layout v layout.php) */
}

/* Tabulky: dropdowny v responsive kontejnerech nesmí být oříznuté overflowem */
.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

/* Dropdown menu musí být nad modaly/offcanvas (jinak se jeví jako „schované“) */
.dropdown-menu {
    z-index: 1100;
}

/* Scrollovat svisle v modalu, ale neřezat dropdowny na ose X */
.modal-dialog-scrollable .modal-body {
    overflow-x: visible;
}

/* -----------------------------------------------------------------------
   XS modals: jednotná stabilizace výšky vůči viewportu

   Cíl:
   - modál nikdy nepřeteče mimo viewport (i na nízkých výškách)
   - svisle scrolluje pouze .modal-body
   - footer s tlačítky zůstane dosažitelný scrollováním uvnitř modálu
   ----------------------------------------------------------------------- */
.xs-modal .modal-dialog {
    /* Bezpečné omezení výšky dialogu vůči viewportu */
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
}

.xs-modal .modal-content {
    /* Vynutit flex layout, aby .modal-body mohl být scrollovatelný */
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/*
   Některé modály (např. formuláře) mají strukturu:
     .modal-content > form > (.modal-header, .modal-body, .modal-footer)
   V takovém případě flex na .modal-content nestačí a .modal-body pak nemá
   žádný výškový constraint → chybí vnitřní scrollbar.
   Tato pravidla zajišťují konzistentní scrollování uvnitř .modal-body.
*/
.xs-modal .modal-content > form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.xs-modal .modal-content > form > .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* Pokud je dialog označen jako scrollable, nastavíme mu explicitní výšku (spolehlivé i při nestandardním layoutu stránky) */
.xs-modal .modal-dialog.modal-dialog-scrollable {
    height: calc(100vh - 2rem);
    height: calc(100dvh - 2rem);
}

/* Nechceme, aby scrolloval wrapper .modal; scroll musí být pouze v .modal-body */
.xs-modal.modal {
    overflow: hidden !important;
}

.xs-modal .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* Přijaté faktury: modál „Vytvořit fakturu“ musí být ovladatelný i na nízké výšce obrazovky.
   U některých kombinací obsahu (taby + tabulky) se modal-body zvětší tak, že footer s tlačítky není vidět.
   Vynutíme proto max výšku modalu a svislé scrollování uvnitř. */
#modalInvoiceCreate .modal-dialog {
    height: calc(100vh - 2rem);
}

#modalInvoiceCreate .modal-content {
    max-height: calc(100vh - 2rem);
}

#modalInvoiceCreate .modal-body {
    overflow-y: auto;
}

.badge-pill {
    border-radius: 999px;
}

/* Ikony v Rychlm pehledu slueb */
.service-item-icon {
    width: 48px;
    height: 48px;
    display: block;
    transition: transform .2s ease, filter .2s ease;
}

.service-item {
    transition: background-color .15s ease;
    border-radius: .75rem;
    padding: .25rem .4rem;
    margin-left: -.4rem;
    margin-right: -.4rem;
}

.service-item:hover {
    background-color: rgba(13,110,253,0.03); /* jemn zvraznn dku */
}

.service-item:hover .service-item-icon {
    transform: translateY(-2px) scale(1.05);
    filter: drop-shadow(0 .35rem .75rem rgba(15,23,42,0.18));
}

.service-card-icon {
    width: 48px;
    height: 48px;
    display: block;
    object-fit: contain;
    transition: transform .2s ease, filter .2s ease;
}

.card:hover .service-card-icon {
    transform: translateY(-2px) scale(1.04);
    filter: drop-shadow(0 .35rem .8rem rgba(15,23,42,.18));
}

/* Stavová tečka pro indikaci stavu CHR serveru */
.status-dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    display: inline-block;
}

/* RBAC / Permissions: škálovatelný vzhled pro desítky až stovky oprávnění */
.xs-perm-assign-card {
    overflow: hidden;
}

.xs-perm-assign-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: .75rem 1rem;
}

.xs-perm-assign-list {
    padding: 0 1rem 1rem 1rem;
    max-height: calc(100vh - 420px);
    overflow: auto;
}

.xs-perm-item {
    padding: .65rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,.06);
}

.xs-perm-item:last-child {
    border-bottom: 0;
}

.xs-perm-item code {
    font-size: .82rem;
}

@media (max-width: 991.98px) {
    .xs-perm-assign-list {
        max-height: calc(100vh - 520px);
    }
}



/* IT Q&A */
.itqa-article-body img { max-width: 100%; height: auto; }
.itqa-article-body pre { background: #f8f9fa; padding: 12px; border-radius: 8px; overflow:auto; }
.itqa-article-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* Multidropdown (submenu) – Bootstrap 5 nested dropdown */
.dropdown-menu .dropdown-submenu {
    position: relative;
}

.dropdown-menu .dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -0.125rem;
}

/* Pokud submenu nevejde doprava (detekuje JS), otevři ho doleva */
.dropdown-menu .dropdown-submenu.xs-open-left > .dropdown-menu {
    right: 100%;
    left: auto;
}

/* Submenu fallback: při nedostatku místa se přepne doleva (řeší JS) */
.dropdown-menu .dropdown-submenu.xs-open-left > .dropdown-menu {
    right: 100%;
    left: auto;
}

/* Hover chování dropdownů odstraněno – menu se otevírá pouze na kliknutí. */


.dropdown-menu .xs-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-menu .xs-submenu-toggle::after {
    content: "\203A"; /* › */
    font-size: 1.05rem;
    line-height: 1;
    opacity: .75;
}

/* Mobil/offcanvas: submenu raději rozbalit do seznamu (bez flyout), aby se nic neořezávalo */
@media (max-width: 991.98px) {
    .dropdown-menu .dropdown-submenu > .dropdown-menu {
        position: static;
        margin-top: .25rem;
        margin-left: 1rem;
        border: 0;
        box-shadow: none;
    }
    .dropdown-menu .xs-submenu-toggle::after {
        content: "\25BE"; /* ▾ */
    }
}

/* Dashboard tiles: prevent excessive growth.
   Important: scrollbar must not overlap the header (title + action buttons). */
.xs-dashboard-tile .card-body {
    max-height: 350px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.xs-dashboard-tile .xs-tile-header {
    flex: 0 0 auto;
}

.xs-dashboard-tile .xs-tile-scroll {
    flex: 1 1 auto;
    min-height: 0; /* required so the flex child can scroll */
    overflow: auto;
}

.xs-dashboard-tile .xs-tile-header-actions {
    flex: 0 0 auto;
}

.xs-dashboard-tile.xs-tile-minimized .card-body {
    max-height: none;
    overflow: hidden;
}

.xs-dashboard-hidden-tiles .list-group-item {
    cursor: default;
}

/* Dashboard tiles: carousel pagination inside tiles */
.xs-tile-carousel {
    position: relative;
    padding-left: 2.25rem;
    padding-right: 2.25rem;
}

.xs-tile-carousel .carousel-control-prev,
.xs-tile-carousel .carousel-control-next {
    width: 2.25rem;
}

.xs-tile-carousel .carousel-control-prev-icon,
.xs-tile-carousel .carousel-control-next-icon {
    opacity: .65;
}

.xs-tile-carousel-hint {
    text-align: center;
}


/* =========================
   Xservices One landing
   ========================= */
.xs-one-hero {
    background: linear-gradient(180deg, rgba(13,110,253,0.08) 0%, rgba(13,110,253,0.02) 100%);
}

.xs-one-hero-icon {
    max-width: 320px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.12));
}

.xs-one-card {
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.06);
    transition: transform .12s ease, box-shadow .12s ease;
}

a.xs-one-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(0,0,0,0.10);
}

.xs-one-card-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.10);
}

.xs-one-pill {
    border: 1px solid rgba(0,0,0,0.08);
    background: #fff;
    border-radius: 999px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}

/* --- Main navigation: "Moje firma" link (decent emphasis, no CTA) --------------- */
.xs-nav-my-company {
    font-weight: 600;
    color: rgba(13, 110, 253, 0.85) !important; /* bootstrap primary, slightly softened */
}

.xs-nav-my-company:hover,
.xs-nav-my-company:focus {
    color: rgba(13, 110, 253, 1) !important;
}

/* --- My Company: Breadcrumb (UI-only, no routing changes) -------------------- */
.xs-breadcrumb {
    --bs-breadcrumb-divider: '›';
}

.xs-breadcrumb .breadcrumb {
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0;
}

.xs-breadcrumb .breadcrumb-item {
    font-size: .875rem;
    line-height: 1.1;
}

.xs-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    opacity: .65;
}

.xs-breadcrumb a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.xs-breadcrumb a:hover,
.xs-breadcrumb a:focus {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.xs-breadcrumb .breadcrumb-item.active {
    color: var(--bs-body-color);
    font-weight: 600;
}

.xs-breadcrumb .xs-bc-label {
    display: inline-block;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}


/* XS Alerts — inline variant (replacement for Bootstrap .alert boxes) */
.xs-alert-inline{
    display: block;
    box-shadow: none;
    padding: .9rem 1rem;
    border-radius: .5rem;
    border: 1px solid transparent;
    color: inherit;
}
.xs-alert-inline .xs-alert-icon{ display: none; }
.xs-alert-inline .xs-alert-close{ display: none; }
.xs-alert-inline .xs-alert-message{
    white-space: normal;
    line-height: inherit;
}
.xs-alert-sm{
    padding: .5rem .75rem;
    border-radius: .375rem;
    font-size: .875rem;
}

/* Inline color palette aligned to Bootstrap 5 alerts */
.xs-alert-inline.xs-alert-success{ background: #d1e7dd; color: #0f5132; border-color: #badbcc; }
.xs-alert-inline.xs-alert-info{ background: #cff4fc; color: #055160; border-color: #b6effb; }
.xs-alert-inline.xs-alert-warning{ background: #fff3cd; color: #664d03; border-color: #ffecb5; }
.xs-alert-inline.xs-alert-danger{ background: #f8d7da; color: #842029; border-color: #f5c2c7; }
.xs-alert-inline.xs-alert-secondary{ background: #e2e3e5; color: #41464b; border-color: #d3d6d8; }
.xs-alert-inline.xs-alert-light{ background: #f8f9fa; color: #212529; border-color: #e2e3e5; }

@media (max-width: 576px) {
    .xs-breadcrumb .xs-bc-label { max-width: 11rem; }
}

/* FIX: Moje firma – povolit shrink obsahu karet */
.xs-my-company-grid .d-flex,
.xs-my-company-grid .flex-grow-1 {
    min-width: 0;
}

/* ---------------------------------------------------------------------------
   XS Alerts (floating notifications)
   Inspired by Bootsnipp 0ebmD (adapted for Bootstrap Icons + existing BS5 theme)
--------------------------------------------------------------------------- */
.xs-alerts-host{
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none; /* allow clicks to pass through except on alerts */
}

.xs-alert{
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: 10px;
    color: #fff;
    box-shadow: 0 .5rem 1.25rem rgba(0,0,0,.18);
}

.xs-alert .xs-alert-icon{
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255,255,255,.15);
}

.xs-alert .xs-alert-message{
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25rem;
    white-space: pre-line; /* keep \n */
    word-break: break-word;
}

.xs-alert .xs-alert-close{
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.9);
    padding: .1rem;
    margin-left: .25rem;
    line-height: 1;
    opacity: .85;
}

.xs-alert .xs-alert-close:hover{
    opacity: 1;
}

.xs-alert-success{ background: #28a745; }
.xs-alert-info{ background: #17a2b8; }
.xs-alert-warning{ background: #f0ad4e; color: #1f1f1f; }
.xs-alert-warning .xs-alert-close{ color: rgba(0,0,0,.75); }
.xs-alert-warning .xs-alert-close:hover{ color: rgba(0,0,0,.95); }
.xs-alert-warning .xs-alert-icon{ background: rgba(0,0,0,.12); }
.xs-alert-danger{ background: #dc3545; }

@media (max-width: 576px){
    .xs-alerts-host{
        left: .75rem;
        right: .75rem;
        top: .75rem;
        max-width: none;
    }
}
