/* Fulltatil AdminPanel reference: control-theme.css + admin-theme.css.
   The named layer lets this bounded theme override legacy unlayered !important
   declarations without rewriting site.css. HotelCode branding stays in site.css. */
@layer hotelcode-admin-theme {
    body.hotelcode-light-theme {
        --app-bg: #f4f6f8 !important;
        --surface: #fff !important;
        --surface-muted: #f8fafb !important;
        --border: #d8dee5 !important;
        --text: #1f2937 !important;
        --muted: #52606d !important;
        --primary: #23764f !important;
        --primary-strong: #195d3c !important;
        --primary-soft: #edf6f0 !important;
        --sidebar: #fff !important;
        --sidebar-soft: #f8fafb !important;
        --hotelcode-heading-color: #1f2937 !important;
        --hotelcode-label-color: #334155 !important;
        --hotelcode-secondary-color: #52606d !important;
        --hotelcode-icon-color: #23764f !important;
        --ui-font: "Source Sans Pro", "Segoe UI", Arial, sans-serif;
        --ui-control-height: 36px;
        --ui-control-radius: 10px;
        --ui-shadow: 0 2px 8px rgb(15 23 42 / 5%);
        --ui-popup-shadow: 0 8px 24px rgb(15 23 42 / 12%);
        --bs-link-color: #23764f;
        --bs-link-hover-color: #195d3c;
        color: var(--text) !important;
        background: var(--app-bg) !important;
        font-family: var(--ui-font) !important;
        color-scheme: light;
    }

    body.hotelcode-light-theme :is(h1, h2, h3, h4, h5, h6, input, select, textarea, button, .btn) {
        font-family: var(--ui-font) !important;
    }

    /* Opaque neutral surfaces, restrained shadows, and the existing page layout. */
    body.hotelcode-light-theme :is(.app-sidebar, .mobile-topbar, .mobile-nav,
        .public-landing-header, .site-footer, .app-footer, .mobile-admin-tabbar, .card, .analytics-card, .tc-card,
        .kpi-card, .metric-tile, .auth-card, .dash-card, .pricing-card,
        .visual-module-card, .visual-workflow-step, .public-analysis-tool-card,
        .legal-content-card, .seo-page-hero-card, .user-chip, .saas-hero,
        .landing-section, .hero-ai-window, .hero-ai-card, .auth-trial-cta, .flight-ai-comment-card) {
        color: var(--text) !important;
        background: var(--surface) !important;
        border-color: var(--border) !important;
        box-shadow: var(--ui-shadow) !important;
        backdrop-filter: none !important;
    }

    body.hotelcode-light-theme :is(.card, .analytics-card, .tc-card, .kpi-card,
        .metric-tile, .auth-card, .dash-card, .pricing-card, .visual-module-card,
        .public-analysis-tool-card, .legal-content-card, .seo-page-hero-card) {
        border-radius: 20px !important;
    }

    body.hotelcode-light-theme :is(.page-header, .tc-card-header, .analytics-card-header,
        .card-header, .sidebar-footer, .sidebar-subnav, .sidebar-admin-subnav) {
        background: transparent !important;
        border-color: var(--border) !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme :is(.page-header, .tc-card, .analytics-card, .auth-card)::before,
    body.hotelcode-light-theme :is(.page-header, .tc-card, .analytics-card, .auth-card)::after {
        background: none !important;
        box-shadow: none !important;
        pointer-events: none;
    }

    body.hotelcode-light-theme :is(.public-analysis-notice, .usage-summary,
        .daily-usage-summary, .public-analysis-tools, .home-landing-page,
        .overview-dashboard-flow > div, .hero-proof-grid > div) {
        background: var(--surface-muted) !important;
        border-color: var(--border) !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme .saas-hero-bg,
    body.hotelcode-light-theme :is(.saas-hero, .landing-section)::before,
    body.hotelcode-light-theme :is(.saas-hero, .landing-section)::after {
        background: none !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme :is(.modal-content, .dropdown-menu, .popover,
        .stay-calendar, [data-hotel-results]) {
        color: var(--text) !important;
        background-color: var(--surface) !important;
        border-color: var(--border) !important;
        box-shadow: var(--ui-popup-shadow) !important;
    }

    body.hotelcode-light-theme :is(.sidebar-link, .sidebar-sub-link, .sidebar-admin-summary) {
        color: var(--text) !important;
        border-radius: 10px !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme :is(.sidebar-link, .sidebar-sub-link, .sidebar-admin-summary):hover {
        color: var(--primary-strong) !important;
        background: #f1f4f7 !important;
    }

    body.hotelcode-light-theme :is(.sidebar-link.active, .sidebar-sub-link.active,
        .sidebar-admin-group.active > .sidebar-admin-summary) {
        color: var(--primary-strong) !important;
        background: var(--primary-soft) !important;
        box-shadow: inset 3px 0 0 var(--primary) !important;
    }

    body.hotelcode-light-theme.rtl-page :is(.sidebar-link.active, .sidebar-sub-link.active,
        .sidebar-admin-group.active > .sidebar-admin-summary) {
        box-shadow: inset -3px 0 0 var(--primary) !important;
    }

    body.hotelcode-light-theme :is(.mobile-role-pill, .mobile-admin-tabbar-link.active) {
        color: var(--primary-strong) !important;
        -webkit-text-fill-color: var(--primary-strong) !important;
        background: var(--primary-soft) !important;
        border-color: #a9c7b5 !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme .mobile-admin-tabbar-link:not(.active) {
        color: var(--muted) !important;
        background: transparent !important;
    }

    body.hotelcode-light-theme .mobile-admin-tabbar-link > i { color: inherit !important; }

    body.hotelcode-light-theme .language-switcher {
        min-height: 36px !important;
        border: 1px solid #8996a4 !important;
        border-radius: 10px !important;
        background: var(--surface) !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme .language-switcher-select {
        color: var(--text) !important;
        font: 600 13px/1.5 var(--ui-font) !important;
    }

    body.hotelcode-light-theme :is(.form-label, .tc-form-label, label:not(.form-check-label)) {
        margin-bottom: 6px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
        letter-spacing: normal !important;
        text-transform: none !important;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select):where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"])) {
        color: var(--text) !important;
        -webkit-text-fill-color: var(--text) !important;
        background-color: var(--surface) !important;
        border: 1px solid #8996a4 !important;
        border-radius: var(--ui-control-radius) !important;
        padding: 6px 10px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        line-height: 1.5 !important;
        box-shadow: 0 1px 2px rgb(15 23 42 / 4%) !important;
    }

    body.hotelcode-light-theme input.form-control:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    body.hotelcode-light-theme select:is(.form-control, .form-select):not([multiple]):not([size]),
    body.hotelcode-light-theme select:is(.form-control, .form-select)[size="1"]:not([multiple]) {
        height: var(--ui-control-height) !important;
        min-height: var(--ui-control-height) !important;
    }

    body.hotelcode-light-theme textarea.form-control {
        min-height: 100px !important;
        height: auto !important;
        resize: vertical;
    }

    body.hotelcode-light-theme select.form-select:not([multiple]):not([size]),
    body.hotelcode-light-theme select.form-select[size="1"]:not([multiple]) {
        padding-inline-end: 32px !important;
    }

    body.hotelcode-light-theme .stay-range-control > .form-control {
        padding-inline-end: 38px !important;
        cursor: pointer;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select)::placeholder {
        color: #52606d !important;
        -webkit-text-fill-color: #52606d !important;
        opacity: 1 !important;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select):is(:disabled, [readonly]):not([data-stay-display]) {
        background-color: #f1f4f7 !important;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select):disabled {
        color: #52606d !important;
        -webkit-text-fill-color: #52606d !important;
        cursor: not-allowed;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select):focus {
        border-color: var(--primary) !important;
        box-shadow: 0 0 0 3px rgb(35 118 79 / 16%) !important;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select):is(.is-invalid, .input-validation-error),
    body.hotelcode-light-theme .was-validated :is(.form-control, .form-select):invalid {
        border-color: #b42318 !important;
    }

    body.hotelcode-light-theme :is(.form-control, .form-select).is-valid,
    body.hotelcode-light-theme .was-validated :is(.form-control, .form-select):valid {
        border-color: var(--primary) !important;
    }

    body.hotelcode-light-theme .form-control:is(.is-valid, .is-invalid) {
        padding-inline-end: 32px !important;
    }

    body.hotelcode-light-theme .form-select:is(.is-valid, .is-invalid):not([multiple]) {
        padding-inline-end: 56px !important;
    }

    body.hotelcode-light-theme :is(.form-check-input:checked, .page-item.active .page-link) {
        background-color: var(--primary) !important;
        border-color: var(--primary) !important;
    }

    body.hotelcode-light-theme :is(.btn:not(.btn-link), .nav-pills .nav-link, .stay-night-button) {
        min-height: var(--ui-control-height) !important;
        height: auto !important;
        max-width: 100%;
        padding: 6px 12px !important;
        border-radius: var(--ui-control-radius) !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        line-height: 1.5 !important;
        letter-spacing: normal !important;
        text-transform: none !important;
        text-shadow: none !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        transform: none !important;
    }

    body.hotelcode-light-theme :is(.btn-primary, .btn-success, .nav-pills .nav-link.active,
        .stay-night-button[aria-pressed="true"], .brand-nav-primary) {
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        background: var(--primary) !important;
        border-color: var(--primary) !important;
        box-shadow: 0 1px 2px rgb(15 23 42 / 8%) !important;
    }

    body.hotelcode-light-theme :is(.btn-primary, .btn-success, .nav-pills .nav-link.active,
        .stay-night-button[aria-pressed="true"], .brand-nav-primary):is(:hover, :active, :focus-visible):not(:disabled):not(.disabled) {
        background: var(--primary-strong) !important;
        border-color: var(--primary-strong) !important;
    }

    body.hotelcode-light-theme :is(.btn-outline-primary, .btn-outline-success, .btn-outline-light,
        .btn-light, .btn-secondary, .btn-outline-secondary, .auth-back-link, .stay-night-button:not([aria-pressed="true"])) {
        color: var(--primary-strong) !important;
        -webkit-text-fill-color: var(--primary-strong) !important;
        background: var(--surface) !important;
        border-color: #8996a4 !important;
        box-shadow: 0 1px 2px rgb(15 23 42 / 4%) !important;
    }

    body.hotelcode-light-theme :is(.nav-pills .nav-link:not(.active), .page-link, .btn-link) {
        color: var(--primary-strong) !important;
        -webkit-text-fill-color: var(--primary-strong) !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme :is(.btn-outline-primary, .btn-outline-success, .btn-outline-light,
        .btn-light, .btn-secondary, .btn-outline-secondary, .auth-back-link,
        .nav-pills .nav-link:not(.active), .stay-night-button:not([aria-pressed="true"])):is(:hover, :active):not(:disabled):not(.disabled) {
        color: var(--primary-strong) !important;
        -webkit-text-fill-color: var(--primary-strong) !important;
        background: var(--primary-soft) !important;
        border-color: var(--primary) !important;
    }

    body.hotelcode-light-theme .btn > :is(i, span:not(.badge):not(.spinner-border):not(.spinner-grow)) {
        color: inherit !important;
        -webkit-text-fill-color: inherit !important;
    }

    body.hotelcode-light-theme .btn > :is(i, .spinner-border, .spinner-grow) { flex-shrink: 0; }

    body.hotelcode-light-theme .btn.icon-btn {
        min-width: 36px !important;
        width: 36px !important;
        padding: 6px !important;
    }

    body.hotelcode-light-theme :is(.btn, .nav-link):is(:disabled, .disabled, [aria-disabled="true"]) {
        opacity: .65 !important;
        cursor: not-allowed;
        box-shadow: none !important;
    }

    body.hotelcode-light-theme :is(.btn, .nav-link, .form-control, .form-select,
        .form-check-input, .sidebar-link, .sidebar-sub-link, .sidebar-admin-summary,
        .stay-night-button, .airport-picker-summary, .language-switcher-select,
        .mobile-admin-tabbar-link):focus-visible {
        outline: 3px solid var(--primary) !important;
        outline-offset: 3px !important;
    }

    body.hotelcode-light-theme .input-group > :not(:first-child):not(.invalid-feedback):not(.valid-feedback) {
        border-start-start-radius: 0 !important;
        border-end-start-radius: 0 !important;
    }

    body.hotelcode-light-theme .input-group > :not(:last-child):not(.invalid-feedback):not(.valid-feedback) {
        border-start-end-radius: 0 !important;
        border-end-end-radius: 0 !important;
    }

    body.hotelcode-light-theme .input-group-text {
        min-height: var(--ui-control-height) !important;
        height: auto !important;
        padding: 6px 10px !important;
        line-height: 1.5 !important;
        color: var(--muted) !important;
        background: #f1f4f7 !important;
        border-color: #8996a4 !important;
        border-radius: 10px !important;
        font-size: 13px !important;
    }

    body.hotelcode-light-theme :is(.table, .app-table) {
        --bs-table-border-color: #d8dee5 !important;
        --bs-table-striped-bg: #f8fafb !important;
        --bs-table-hover-bg: #f1f4f7 !important;
    }

    body.hotelcode-light-theme :is(.table, .app-table) :is(thead, thead tr, thead th) {
        color: #475569 !important;
        -webkit-text-fill-color: #475569 !important;
        background: #f1f4f7 !important;
        border-color: var(--border) !important;
    }

    body.hotelcode-light-theme :is(.table, .app-table) :is(tbody td, tbody th) {
        border-color: var(--border) !important;
    }

    @media (prefers-reduced-motion: reduce) {
        body.hotelcode-light-theme :is(.btn, .nav-link, .form-control, .form-select) {
            transition: none !important;
        }
    }

    @media (forced-colors: active) {
        body.hotelcode-light-theme :focus-visible { outline: 3px solid Highlight !important; }
    }
}

/* Keep display outside the important layer so Bootstrap's responsive visibility
   utilities (d-none / d-lg-none) continue to hide controls at the right size. */
body.hotelcode-light-theme :is(.btn:not(.btn-link), .nav-pills .nav-link, .stay-night-button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
