/* =========================================================
   Material Icons (LOCAL)
   Files:
   - wwwroot/fonts/MaterialIcons-Regular.woff2
   - wwwroot/fonts/MaterialIcons-Regular.woff
========================================================= */

@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    font-display: swap; /* prevents long invisible text / icons */
    src: url('/fonts/MaterialIcons-Regular.woff2') format('woff2'), url('/fonts/MaterialIcons-Regular.woff') format('woff');
}

/* Ensure Material Icons glyph rendering is stable */
.material-icons,
.rzi,
.rz-icon,
.rz-icon-material {
    font-family: 'Material Icons' !important;
    font-weight: normal;
    font-style: normal;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
}

/* Base */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3...==) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.event-pill {
    cursor: pointer;
}

    .event-pill:hover {
        filter: brightness(0.95);
    }

/* Icons */
.uicon {
    margin-right: 6px;
}

.uicon-ok {
    color: #2e7d32;
}

.uicon-admin {
    color: #1565c0;
}

.uicon-warn {
    color: #ed6c02;
}

.uicon-danger {
    color: #d32f2f;
}

.uicon-muted {
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.5;
}

/* Radzen dialog tweaks */
.rz-dialog-mask {
    background-color: rgba(15, 23, 42, 0.55) !important;
}

.rz-dialog-wrapper {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1050 !important;
}

.rz-dialog {
    border-radius: 12px;
    animation: dialog-pop 0.18s ease-out;
}

@keyframes dialog-pop {
    from {
        transform: scale(0.94);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.rz-datepicker-calendar,
.rz-timepicker-popup,
.rz-dropdown-panel,
.rz-autocomplete-panel {
    z-index: 1060 !important;
}

/* Radzen calendar dropdown: disable triggers */
.rz-calendar-month-dropdown .rz-dropdown-trigger,
.rz-calendar-year-dropdown .rz-dropdown-trigger {
    pointer-events: none !important;
}

span.rz-dropdown-trigger-icon.rzi.rzi-chevron-down::before {
    content: "" !important;
}

.rz-calendar-month-dropdown,
.rz-calendar-year-dropdown {
    pointer-events: none !important;
}

.cc-card-title i {
    opacity: .85;
}

button i {
    font-size: 1.05em;
    vertical-align: -0.05em;
}

.calendar-multiselect {
    width: 100%;
}

/* =========================================================
   Users.razor ONLY (scoped styles)
   Requires wrapper: <div class="users-grid-scope"> ... </div>
========================================================= */

/* Hover + cursor */
.users-grid-scope .rz-datatable-data tr:hover {
    background-color: rgba(25, 118, 210, 0.06);
}

.users-grid-scope .rz-datatable-data tr {
    cursor: pointer;
}

/* ---------------------------------------------------------
   CRITICAL: Radzen selected-row highlight
   Some themes apply:
   - background
   - color
   - text-shadow
   - filter
   - -webkit-text-fill-color
   We neutralize them ONLY inside Users grid.

   IMPORTANT:
   Do NOT override generic <span> colors here, because Radzen badges
   (Status/Role chips) are rendered as <span> and would turn black.
--------------------------------------------------------- */
.users-grid-scope .rz-grid-table tbody tr.rz-state-highlight,
.users-grid-scope .rz-grid-table tbody tr.rz-state-highlight:hover,
.users-grid-scope .rz-grid-table tbody tr.rz-state-highlight > td,
.users-grid-scope .rz-grid-table tbody tr.rz-state-highlight:hover > td {
    background-color: transparent !important;
    color: inherit !important;
    filter: none !important;
    text-shadow: none !important;
    -webkit-text-fill-color: currentColor !important;
}

    /* If Radzen applies colors to interactive descendants */
    .users-grid-scope .rz-grid-table tbody tr.rz-state-highlight a,
    .users-grid-scope .rz-grid-table tbody tr.rz-state-highlight i,
    .users-grid-scope .rz-grid-table tbody tr.rz-state-highlight button {
        color: inherit !important;
        filter: none !important;
        text-shadow: none !important;
        -webkit-text-fill-color: currentColor !important;
    }

/* Safety: make sure we don't visually "invert" focused rows/cells */
.users-grid-scope .rz-grid-table tbody tr:focus,
.users-grid-scope .rz-grid-table tbody tr:focus-within,
.users-grid-scope .rz-grid-table tbody td:focus,
.users-grid-scope .rz-grid-table tbody td:focus-within {
    outline: none !important;
}

/* ---------------------------------------------------------
   CRITICAL: Popover must not be clipped by Radzen wrappers
--------------------------------------------------------- */
.users-grid-scope .rz-datatable,
.users-grid-scope .rz-datatable-wrapper,
.users-grid-scope .rz-datatable-data,
.users-grid-scope .rz-grid-table,
.users-grid-scope .rz-grid-table-fixed,
.users-grid-scope .rz-grid-table-striped {
    overflow: visible !important;
}

/* Calendars cell */
.users-grid-scope .cal-cell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

/* First calendar label */
.users-grid-scope .cal-first {
    color: #0b5ed7;
    text-decoration: underline;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

/* +N badge */
.users-grid-scope .cal-more {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    cursor: pointer;
    line-height: 18px;
}

/* popover panel */
.users-grid-scope .cal-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 5000;
    min-width: 280px;
    max-width: 460px;
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    padding: 10px;
}

.users-grid-scope .cal-pop-title {
    font-weight: 600;
    font-size: 13px;
    padding: 2px 6px 8px;
}

.users-grid-scope .cal-pop-list {
    max-height: 240px;
    overflow: auto;
    padding-right: 4px;
}

.users-grid-scope .cal-pop-item {
    padding: 6px 8px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .users-grid-scope .cal-pop-item:hover {
        background: rgba(25, 118, 210, 0.06);
    }

.cal-cell {
    position: relative;
}

.cal-more {
    position: relative;
    z-index: 1000;
    pointer-events: auto;
}

.cal-pop {
    display: none;
    max-width: 520px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.15);
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    white-space: normal;
}

.cal-more {
    cursor: pointer;
    margin-left: 6px;
}

.cal-cell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cal-more {
    border: 1px solid #bbb;
    background: #fff3a6;
    padding: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.cal-pop {
    min-width: 220px;
    max-width: 320px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
    padding: 10px;
}

.cal-pop-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.cal-pop-list {
    display: grid;
    gap: 6px;
    max-height: 240px;
    overflow: auto;
    padding-right: 4px;
}

.cal-pop-item {
    padding: 6px 8px;
    border-radius: 10px;
    background: #f6f6f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   Floating Action Button (FAB) – Global
   Used for: Create Calendar, Institutions, ...
========================================================= */

.cc-fab {
    position: fixed;
    right: calc(24px + env(safe-area-inset-right, 0px));
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: 58px;
    height: 58px;
    border-radius: 999px;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2000;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 22px rgba(88, 80, 236, 0.35);
    transition: transform .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

    .cc-fab:focus {
        outline: none;
    }

    .cc-fab:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 26px rgba(88, 80, 236, 0.45);
    }

    .cc-fab:active {
        transform: scale(0.92);
        box-shadow: 0 6px 18px rgba(88, 80, 236, 0.35);
    }

    .cc-fab:focus-visible {
        box-shadow: 0 8px 22px rgba(88, 80, 236, 0.35), 0 0 0 4px rgba(99, 102, 241, 0.35);
    }

.cc-fab-icon {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
}

@media (max-width: 768px) {
    .cc-fab {
        width: 50px;
        height: 50px;
        right: calc(24px + env(safe-area-inset-right, 0px));
        bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .cc-fab-icon {
        font-size: 1.6rem;
    }
}

/* ===== GLOBAL SEARCH PILL ===== */

.cc-search-container {
    min-width: 220px;
    width: min(320px, 100%);
    display: flex;
    justify-content: flex-end;
}

.cc-search {
    width: 220px;
    transition: width 160ms ease, transform 160ms ease;
}

.cc-search-input {
    width: 100%;
    height: 38px;
    border-radius: 999px;
    padding: 0 14px;
    border: 2px solid var(--rz-primary, #4f46e5);
    background: var(--rz-base-0, #fff);
    outline: none;
    transition: box-shadow 160ms ease, border-color 160ms ease;
}

.cc-search:focus-within {
    width: min(360px, 100%);
    transform: translateY(-1px);
}

    .cc-search:focus-within .cc-search-input {
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
    }

.cc-search-input::placeholder {
    color: rgba(108,117,125,.85);
}

@media (max-width: 640px) {
    .cc-search {
        width: 100%;
    }

        .cc-search:focus-within {
            width: 100%;
            transform: none;
        }
}

/* =========================
   LAYOUT + SIDEBAR (global)
   ========================= */

.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    min-width: 0; /* důležité pro flex layout */
}

/* =========================================================
   SIDEBAR VISUAL DESIGN (restore original dark look)
========================================================= */

/* Sidebar gradient + base text color */
.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    color: #e6e6e6;
}

    /* Nav header */
    .sidebar .top-row {
        background: transparent;
        border-bottom: 1px solid rgba(255,255,255,0.15);
    }

    /* Brand */
    .sidebar .navbar-brand {
        color: #ffffff !important;
        font-weight: 600;
        text-decoration: none;
    }

        .sidebar .navbar-brand:hover {
            opacity: 0.9;
        }

    /* Nav links */
    .sidebar .nav-link {
        color: #d7d7d7;
        border-radius: 6px;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

        /* Hover */
        .sidebar .nav-link:hover {
            background-color: rgba(255,255,255,0.10);
            color: #ffffff;
        }

        /* Active */
        .sidebar .nav-link.active {
            background-color: rgba(255,255,255,0.25);
            color: #ffffff !important;
        }

    /* Icons */
    .sidebar .bi {
        color: #d7d7d7;
    }

    .sidebar .nav-link:hover .bi,
    .sidebar .nav-link.active .bi {
        color: #ffffff;
    }

    /* Logout button link style */
    .sidebar .btn-link {
        color: #d7d7d7;
        text-decoration: none;
    }

        .sidebar .btn-link:hover {
            color: #ffffff;
        }

/* Mobile */
@media (max-width: 640.98px) {
    /* nic extra – sidebar jede přes NavMenu hamburger */
}

/* Desktop */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
        transition: width 180ms ease;
        flex-shrink: 0;
    }

        .sidebar.collapsed {
            width: 56px;
        }

        /* Default padding pro content (expanded sidebar) */
        .sidebar:not(.collapsed) ~ main .content {
            padding-left: 2rem !important;
            padding-right: 1.5rem !important;
        }

        /* Menší padding když je sidebar collapsed */
        .sidebar.collapsed ~ main .content {
            padding-left: 1rem !important;
            padding-right: 1rem !important;
        }

        /* Collapse chování v NavMenu (text pryč, ikony centrované) */
        .sidebar.collapsed .nav-text {
            display: none;
        }

        .sidebar.collapsed .nav-item {
            padding-left: .25rem;
            padding-right: .25rem;
        }

        .sidebar.collapsed .nav-link {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .sidebar.collapsed .bi {
            margin-right: 0 !important;
        }
}
