/* ── PeopleQ Brand Colors ───────────────────────────────────────────────── */
:root {
    --m3-red:    #c0392b;
    --m3-red-dk: #962d22;
    --m3-orange: #e67e22;
    --m3-orange-lt: #f39c12;

    /* Override Bootstrap primary to PeopleQ red */
    --bs-primary:          #c0392b;
    --bs-primary-rgb:      192, 57, 43;
    --bs-btn-bg:           #c0392b;
    --bs-btn-border-color: #c0392b;
    --bs-btn-hover-bg:     #962d22;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    overflow-x: hidden; /* prevent horizontal page scroll on mobile */
}

/* ── Mobile/iPad bottom nav clearance (< 960px) ─────────────────────────── */
/* Pushes all page content above the fixed bottom nav bar */
@media (max-width: 959px) {
    .mud-main-content .mud-container {
        padding-bottom: 80px !important;
    }
}

h1:focus { outline: none; }

/* ── Layout wrapper ─────────────────────────────────────────────────────── */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-wrapper main {
    flex: 1;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar.bg-primary,
.navbar.bg-m3 {
    background: linear-gradient(135deg, #c0392b 0%, #962d22 100%) !important;
    border-bottom: 3px solid var(--m3-orange);
}

/* Desktop nav — thin vertical divider between items */
.navbar-desktop-nav .nav-item + .nav-item {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* Hover dropdowns — open on mouse-over, no JS click needed */
@media (min-width: 768px) {
    .nav-hover-dropdown:hover > .dropdown-menu {
        display: block;
    }

    .nav-dropdown-menu {
        margin-top: 0;
        border-top: 3px solid var(--m3-orange);
        border-radius: 0 0 0.375rem 0.375rem;
        min-width: 200px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    .nav-dropdown-menu .dropdown-item.active,
    .nav-dropdown-menu .dropdown-item.active:focus,
    .nav-dropdown-menu .dropdown-item.active:hover,
    .nav-dropdown-menu .dropdown-item:active,
    .nav-dropdown-menu .dropdown-item:focus {
        background-color: #fef0e3 !important;
        color: #e67e22 !important;
        font-weight: 600;
    }

    /* Keep the toggle looking like a nav-link (no caret gap weirdness) */
    .nav-hover-dropdown > .nav-link.dropdown-toggle::after {
        vertical-align: middle;
        opacity: 0.7;
    }
}

.navbar-brand {
    overflow: visible;
    padding: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--m3-red) !important;
    border-color: var(--m3-red) !important;
    color: #fff !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--m3-red-dk) !important;
    border-color: var(--m3-red-dk) !important;
}
.btn-outline-primary {
    color: var(--m3-red) !important;
    border-color: var(--m3-red) !important;
}
.btn-outline-primary:hover,
.btn-outline-primary.active,
.btn-check:checked + .btn-outline-primary {
    background-color: var(--m3-red) !important;
    border-color: var(--m3-red) !important;
    color: #fff !important;
}

/* ── Text / icon accent ─────────────────────────────────────────────────── */
.text-primary { color: var(--m3-red) !important; }

/* ── Table accents ───────────────────────────────────────────────────────── */
.table-primary {
    --bs-table-bg:             #f8d7d4;
    --bs-table-striped-bg:     #f5c9c5;
    --bs-table-active-bg:      #f2bcb8;
    --bs-table-hover-bg:       #f5c9c5;
    --bs-table-border-color:   #e8a9a4;
    --bs-table-color:          #212529;
}

/* Weekend rows — subtle warm tint instead of grey */
.table-weekend {
    background-color: #fdf3f2 !important;
    color: #888 !important;
}

/* ── Login card accent ───────────────────────────────────────────────────── */
.login-card-header {
    background: linear-gradient(135deg, #c0392b 0%, #e67e22 100%);
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 1.5rem;
    text-align: center;
}

/* ── Mobile / Responsive ─────────────────────────────────────────────────── */

/* Touch-friendly interactive elements (Apple/Material HIG: min 44px tap target) */
@media (max-width: 767.98px) {
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 1rem; /* prevent iOS auto-zoom on focus */
    }

    .btn:not(.btn-sm):not(.btn-close):not(.navbar-toggler) {
        min-height: 44px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    /* Reduce card padding so content breathes on small screens */
    .card-body {
        padding: 0.875rem;
    }

    /* Page-level title + action rows: wrap and stack on small screens */
    .page-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Modals: constrain to viewport width */
    .modal-lg,
    .modal-xl {
        --bs-modal-width: min(calc(100vw - 2rem), 540px);
    }

    /* Reduce vertical page padding */
    main.container {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Profile dropdown: keep it inside the viewport */
    .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        max-width: calc(100vw - 1rem);
    }

    /* Notification badge position fix on mobile */
    .navbar .badge {
        font-size: 0.6rem;
    }
}

/* ── Time input — match app accent color ────────────────────────────────── */
input[type="time"] {
    accent-color: var(--m3-red);
}

input[type="time"]:focus {
    border-color: var(--m3-red) !important;
    box-shadow: 0 0 0 0.25rem rgba(192, 57, 43, 0.25) !important;
    outline: none;
}

/* ── Blazor validation state ────────────────────────────────────────────── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #dc3545;
}

.validation-message {
    color: #dc3545;
    font-size: 0.82rem;
}

/* ── Mobile nav drawer (Blazor-controlled, slide from left) ─────────────── */

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 85vw);
    height: 100vh;
    background: linear-gradient(135deg, #c0392b 0%, #962d22 100%);
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1044;
}

.mobile-nav-header {
    background: #0f2035;
    border-bottom: 3px solid #e67e22;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.mobile-nav-body {
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.mobile-nav-drawer .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.65rem 1rem;
    border-radius: 0.375rem;
}

.mobile-nav-drawer .nav-link:hover,
.mobile-nav-drawer .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
}

/* ── Mobile navbar: ☰ | m3Global (centred) | 👤 ─────────────────────────── */

/* On mobile the brand is pulled out of normal flow and absolutely centred
   so it stays centred regardless of the toggler/avatar widths on either side */
/* Unread-count badge overlaid on the avatar (mobile navbar) */
.avatar-notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 3px;
    background: #dc3545;
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    border-radius: 999px;
    border: 1.5px solid #fff; /* white ring separates badge from avatar */
    pointer-events: none;
}

@media (max-width: 767.98px) {
    .navbar-brand-center {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1.1rem !important;
        pointer-events: none;
    }
    a.navbar-brand-center {
        pointer-events: auto;
    }
}

/* ── Blazor reconnect: hide default modal, show custom overlay ───────────── */

/* Suppress the built-in "Attempting to reconnect…" modal entirely */
#components-reconnect-modal {
    display: none !important;
}

/* Full-screen translucent backdrop — matches the export animation overlay */
#reconnect-overlay {
    display: none; /* shown via JS when connection drops */
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    animation: reconnect-fadein 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

@keyframes reconnect-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Infinite icon parade — 4.5s cycle, each icon active for 1/3 of the period.
   Delays: Icon1 = 0s, Icon2 = -3s, Icon3 = -1.5s (phase-offset so they never overlap) */
@keyframes exp-icon-loop {
    0%    { transform: translateX(230px); opacity: 0; }
    5.5%  { transform: translateX(88px);  opacity: 1; }
    22.2% { transform: translateX(88px);  opacity: 1; }
    33.3% { transform: translateX(-80px); opacity: 0; }
    33.4% { transform: translateX(230px); opacity: 0; }
    100%  { transform: translateX(230px); opacity: 0; }
}

/* ── Snackbar / Toast notification ──────────────────────────────────────── */
.snackbar {
    position: fixed;
    top: 5rem;
    right: 1.25rem;
    min-width: 300px;
    max-width: calc(100vw - 2rem);
    padding: 0.85rem 1.25rem;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9998;
    animation: snackbar-in 0.25s ease;
}
.snackbar-danger  { background: #dc3545; }
.snackbar-success { background: #198754; }
.snackbar-warning { background: #e67e22; }

@keyframes snackbar-in {
    from { opacity: 0; transform: translateX(1.5rem); }
    to   { opacity: 1; transform: translateX(0);      }
}

/* ── Blazor error banner (permanent connection loss) ─────────────────────── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsa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OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ── Immigration Tabs compact ── */
.imm-tab-header .mud-tab { padding: 0 10px; min-width: 0; font-size: 0.72rem; letter-spacing: 0.03em; }

/* ── MudDatePicker — compact calendar popup ── */
.mud-picker-calendar-header { padding: 8px 12px !important; }
.mud-picker-calendar-header-day { font-size: 0.7rem !important; }
.mud-day { height: 30px !important; width: 30px !important; font-size: 0.75rem !important; }
.mud-picker-calendar { width: 260px !important; min-width: unset !important; }
.mud-picker-calendar-content { padding: 0 8px 8px !important; }
.mud-picker-header { padding: 12px 16px !important; }
.mud-picker-header-content .mud-typography { font-size: 1.5rem !important; }
.mud-picker-header-content .mud-typography-subtitle1 { font-size: 0.85rem !important; }
