/*
 * JRB Holiday Design System
 * Shared visual contract for the server-rendered portal, agent and admin UI.
 * Keep palette values brand-aligned; page-specific CSS should configure, not fork, these tokens.
 */
:root {
    --jrb-color-primary: #00d4ff;
    --jrb-color-primary-strong: #0ea5e9;
    --jrb-color-secondary: #8b5cf6;
    --jrb-color-background: #06060e;
    --jrb-color-surface: #121223;
    --jrb-color-surface-raised: #19192b;
    --jrb-color-surface-overlay: #0d0d1a;
    --jrb-color-border: rgba(255,255,255,.10);
    --jrb-color-border-strong: rgba(255,255,255,.16);
    --jrb-color-text: #f0f0f5;
    --jrb-color-text-muted: #9ca3af;
    --jrb-color-text-subtle: #6b7280;
    --jrb-color-placeholder: #6b7280;
    --jrb-color-success: #10b981;
    --jrb-color-warning: #f59e0b;
    --jrb-color-danger: #ef4444;
    --jrb-color-info: #00d4ff;
    --jrb-color-focus: #00d4ff;
    --jrb-color-focus-ring: rgba(0,212,255,.2);
    --jrb-color-disabled: rgba(255,255,255,.38);
    --jrb-color-hover: rgba(255,255,255,.07);
    --jrb-color-selected: rgba(0,212,255,.14);

    --jrb-space-1: 4px;
    --jrb-space-2: 8px;
    --jrb-space-3: 12px;
    --jrb-space-4: 16px;
    --jrb-space-5: 20px;
    --jrb-space-6: 24px;
    --jrb-space-8: 32px;
    --jrb-space-10: 40px;
    --jrb-space-12: 48px;
    --jrb-space-16: 64px;

    --jrb-radius-sm: 8px;
    --jrb-radius-md: 12px;
    --jrb-radius-lg: 16px;
    --jrb-radius-xl: 20px;
    --jrb-radius-full: 999px;

    --jrb-shadow-sm: 0 2px 8px rgba(0,0,0,.18);
    --jrb-shadow-md: 0 8px 24px rgba(0,0,0,.28);
    --jrb-shadow-lg: 0 18px 48px rgba(0,0,0,.42);
    --jrb-shadow-focus: 0 0 0 3px rgba(0,212,255,.18);

    --jrb-font-body: 'Inter', sans-serif;
    --jrb-font-display: 'Inter', sans-serif;
    --jrb-text-page-title: 1.75rem;
    --jrb-text-section-title: 1.25rem;
    --jrb-text-card-title: 1rem;
    --jrb-text-body: .9375rem;
    --jrb-text-small: .8125rem;
    --jrb-text-caption: .75rem;
    --jrb-text-label: .875rem;
    --jrb-text-button: .875rem;

    --jrb-control-height-sm: 36px;
    --jrb-control-height: 44px;
    --jrb-control-height-lg: 48px;
    --jrb-icon-button-size: 40px;
    --jrb-search-height: 44px;

    --jrb-motion-instant: 100ms;
    --jrb-motion-fast: 150ms;
    --jrb-motion-standard: 200ms;
    --jrb-motion-slow: 320ms;
    --jrb-motion-hover: 160ms;
    --jrb-motion-press: 100ms;
    --jrb-motion-modal: 220ms;
    --jrb-motion-dropdown: 160ms;
    --jrb-motion-page: 240ms;
    --jrb-motion-emphasis: var(--jrb-motion-slow);
    --jrb-ease-standard: cubic-bezier(.2,.7,.2,1);
    --jrb-ease-emphasis: cubic-bezier(.2,.8,.2,1);
}

/* Keep the admin's established darker neutral surface while sharing component semantics. */
.admin-wrapper {
    --jrb-color-background: #0f1117;
    --jrb-color-surface: #121223;
    --jrb-color-surface-raised: #19192b;
    --jrb-color-surface-overlay: #0d0d1a;
    --jrb-color-text: #e0e0e8;
}

/* Shared component primitives. Existing Bootstrap markup remains valid. */
:is(.btn, button.jrb-button, a.jrb-button) {
    transition: color var(--jrb-motion-fast) var(--jrb-ease-standard),
                background-color var(--jrb-motion-fast) var(--jrb-ease-standard),
                border-color var(--jrb-motion-fast) var(--jrb-ease-standard),
                box-shadow var(--jrb-motion-fast) var(--jrb-ease-standard),
                transform var(--jrb-motion-fast) var(--jrb-ease-standard);
}
:is(.btn, button.jrb-button, a.jrb-button):not(.btn-sm):not(.btn-lg) {
    min-height: var(--jrb-control-height);
    padding: .5rem var(--jrb-space-4);
    border-radius: var(--jrb-radius-md);
}
:is(.btn-sm, .jrb-button--sm) {
    min-height: var(--jrb-control-height-sm);
    padding: .35rem var(--jrb-space-3);
    border-radius: var(--jrb-radius-sm);
}
:is(.btn-lg, .jrb-button--lg) {
    min-height: var(--jrb-control-height-lg);
    padding: .65rem var(--jrb-space-5);
    border-radius: var(--jrb-radius-md);
}
:is(.btn, button.jrb-button, a.jrb-button):focus-visible {
    outline: 0;
    box-shadow: var(--jrb-shadow-focus);
}
:is(.btn, button.jrb-button, a.jrb-button):active:not(:disabled) {
    transform: translateY(1px);
}
:is(.btn, button.jrb-button, a.jrb-button):disabled,
:is(.btn, button.jrb-button, a.jrb-button)[aria-disabled="true"] {
    cursor: not-allowed;
}
.pill-btn { border-radius: var(--jrb-radius-md) !important; }

:is(.form-control, .form-select, .jrb-control, .jrb-select, textarea.form-control) {
    min-height: var(--jrb-control-height);
    padding: .5rem var(--jrb-space-3);
    border-radius: var(--jrb-radius-sm);
    font-family: var(--jrb-font-body);
    font-size: var(--jrb-text-body);
    transition: border-color var(--jrb-motion-fast) var(--jrb-ease-standard),
                box-shadow var(--jrb-motion-fast) var(--jrb-ease-standard),
                background-color var(--jrb-motion-fast) var(--jrb-ease-standard);
}
:is(input[type="search"], .jrb-search) { min-height: var(--jrb-search-height); }
:is(.jrb-icon-button, button.icon-button, a.icon-button) {
    width: var(--jrb-icon-button-size);
    min-width: var(--jrb-icon-button-size);
    min-height: var(--jrb-icon-button-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
:is(.form-control, .form-select, .jrb-control, .jrb-select, textarea.form-control):focus {
    box-shadow: var(--jrb-shadow-focus);
}
:is(.form-control, .form-select, .jrb-control, .jrb-select)::placeholder { color: var(--jrb-color-placeholder); opacity: 1; }
:is(.form-control, .form-select, .jrb-control, .jrb-select):disabled,
:is(.form-control, .form-select, .jrb-control, .jrb-select)[aria-disabled="true"] {
    cursor: not-allowed;
}
:is(input, select, textarea, button, a):focus-visible {
    scroll-margin-block: var(--jrb-space-6);
}

:is(.glass-card, .card, .jrb-card) {
    border-radius: var(--jrb-radius-lg);
}
:is(.modal-content, .jrb-dialog) {
    border-radius: var(--jrb-radius-lg);
    box-shadow: var(--jrb-shadow-lg);
}
:is(.dropdown-menu, .jrb-dropdown, .popover) {
    border-radius: var(--jrb-radius-md);
    box-shadow: var(--jrb-shadow-md);
}
:is(.table-responsive, .table-dark-custom, .jrb-table-wrap) {
    border-radius: var(--jrb-radius-md);
}
.table > :not(caption) > * > * {
    vertical-align: middle;
}
:is(.badge, .jrb-badge) {
    border-radius: var(--jrb-radius-sm);
    font-family: var(--jrb-font-body);
}

/* Reusable semantic variants for new/reworked template markup. */
.jrb-card {
    color: var(--jrb-color-text);
    background: var(--jrb-color-surface);
    border: 1px solid var(--jrb-color-border);
    box-shadow: var(--jrb-shadow-sm);
}
.jrb-control,
.jrb-select {
    box-sizing: border-box;
    width: 100%;
    padding: 0 var(--jrb-space-3);
    color: var(--jrb-color-text);
    background: var(--jrb-color-surface-raised);
    border: 1px solid var(--jrb-color-border-strong);
}
.jrb-control::placeholder { color: var(--jrb-color-text-subtle); opacity: 1; }
.jrb-control[aria-invalid="true"], .jrb-select[aria-invalid="true"] {
    border-color: var(--jrb-color-danger);
}
.jrb-button {
    min-height: var(--jrb-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--jrb-space-2);
    padding: 0 var(--jrb-space-4);
    border: 1px solid transparent;
    border-radius: var(--jrb-radius-md);
    font: 600 var(--jrb-text-body)/1.2 var(--jrb-font-body);
    text-decoration: none;
    cursor: pointer;
}
.jrb-button--primary {
    color: #fff;
    background: linear-gradient(135deg,var(--jrb-color-primary),var(--jrb-color-primary-strong));
}
.jrb-button--secondary {
    color: var(--jrb-color-text);
    background: var(--jrb-color-surface-raised);
    border-color: var(--jrb-color-border-strong);
}
.jrb-button--danger {
    color: #fff;
    background: var(--jrb-color-danger);
}
.jrb-button--outline {
    color: var(--jrb-color-text);
    background: transparent;
    border-color: var(--jrb-color-border-strong);
}
.jrb-button--ghost { color: var(--jrb-color-text-muted); background: transparent; }
.jrb-button--success { color: #fff; background: var(--jrb-color-success); }
.jrb-button--icon { width: var(--jrb-icon-button-size); min-width: var(--jrb-icon-button-size); padding: 0; }
.jrb-motion-enter { animation: jrb-enter var(--jrb-motion-emphasis) var(--jrb-ease-standard) both; }
@keyframes jrb-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Shared JRB calendar presentation. The quote page retains only layout-specific
   positioning/stacking rules; native input[type=date] pickers remain native. */
.jdp { position: relative; }
.jdp-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: var(--jrb-space-3);
    width: 100%; min-height: var(--jrb-control-height); padding: 0 var(--jrb-space-3);
    border: 1px solid var(--jrb-color-border-strong); border-radius: var(--jrb-radius-sm);
    color: var(--jrb-color-text); background: var(--jrb-color-surface-raised);
    font: 400 var(--jrb-text-body)/1.4 var(--jrb-font-body); text-align: left; cursor: pointer;
    transition: background-color var(--jrb-motion-hover) var(--jrb-ease-standard),
                border-color var(--jrb-motion-hover) var(--jrb-ease-standard),
                box-shadow var(--jrb-motion-hover) var(--jrb-ease-standard);
}
.jdp-trigger:hover { background: var(--jrb-color-hover); }
.jdp-trigger:focus-visible { outline: 0; border-color: var(--jrb-color-focus); box-shadow: var(--jrb-shadow-focus); }
.jdp-trigger svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--jrb-color-text-muted); transition: transform var(--jrb-motion-dropdown) var(--jrb-ease-standard); }
.jdp-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.jdp-placeholder { color: var(--jrb-color-placeholder); }
.jdp-pop {
    position: absolute; top: calc(100% + var(--jrb-space-2)); left: 0; z-index: 2000;
    width: 284px; padding: var(--jrb-space-3); border: 1px solid var(--jrb-color-border);
    border-radius: var(--jrb-radius-lg); color: var(--jrb-color-text);
    background: var(--jrb-color-surface-overlay); box-shadow: var(--jrb-shadow-lg);
    display: none;
}
.jdp-pop.open { display: block; animation: jrb-enter var(--jrb-motion-dropdown) var(--jrb-ease-standard) both; }
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--jrb-space-2); }
.jdp-title { color: var(--jrb-color-text); font-size: var(--jrb-text-small); font-weight: 600; }
.jdp-nav { display: flex; align-items: center; gap: var(--jrb-space-1); }
.jdp-nav button { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--jrb-radius-sm); color: var(--jrb-color-text-muted); background: transparent; cursor: pointer; }
.jdp-nav button:hover:not(:disabled) { color: var(--jrb-color-text); background: var(--jrb-color-hover); }
.jdp-nav button:focus-visible, .jdp-day:focus-visible { outline: 0; box-shadow: var(--jrb-shadow-focus); }
.jdp-nav button:disabled { opacity: .4; cursor: not-allowed; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 2px; }
.jdp-dow { padding: var(--jrb-space-1) 0; color: var(--jrb-color-text-subtle); font-size: var(--jrb-text-caption); font-weight: 600; text-align: center; }
.jdp-day { min-width: 0; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; color: var(--jrb-color-text); background: transparent; font: 400 var(--jrb-text-small)/1 var(--jrb-font-body); cursor: pointer; }
.jdp-day:hover:not(:disabled):not(.selected) { background: var(--jrb-color-hover); }
.jdp-day.empty { visibility: hidden; pointer-events: none; }
.jdp-day:disabled { color: var(--jrb-color-disabled); cursor: not-allowed; }
.jdp-day.today:not(.selected) { box-shadow: inset 0 0 0 1px var(--jrb-color-border-strong); }
.jdp-day.selected { color: #061018; background: var(--jrb-color-primary); font-weight: 700; }
.glass-card.jdp-host { overflow: visible; }

@media (max-width: 767px) {
    :root {
        --jrb-text-page-title: 1.5rem;
        --jrb-text-section-title: 1.125rem;
        --jrb-control-height: 44px;
        --jrb-control-height-lg: 48px;
    }
}

/* Admin shell currently has legacy !important theme rules; scope these tokens so
   the admin/finance surfaces use the same dimensions without changing their palette. */
.admin-wrapper :is(.form-control, .form-select, textarea.form-control) {
    min-height: var(--jrb-control-height) !important;
    border-radius: var(--jrb-radius-sm) !important;
    font: 400 var(--jrb-text-body)/1.4 var(--jrb-font-body) !important;
}
.admin-wrapper :is(.form-control, .form-select):focus {
    box-shadow: var(--jrb-shadow-focus) !important;
}
.admin-wrapper :is(.glass-card, .card, .stat-card, .stats-card) {
    border-radius: var(--jrb-radius-lg) !important;
}
.admin-wrapper .modal-content { border-radius: var(--jrb-radius-lg) !important; }
.admin-wrapper .dropdown-menu { border-radius: var(--jrb-radius-md) !important; }
.admin-wrapper .table-responsive { border-radius: var(--jrb-radius-md) !important; }
.admin-wrapper :is(.table, table) thead th { padding: var(--jrb-space-3) var(--jrb-space-4) !important; }
.admin-wrapper :is(.table, table) tbody td { padding: 10px var(--jrb-space-4) !important; }
.admin-wrapper .btn { font-family: var(--jrb-font-body) !important; }
.admin-wrapper .btn:not(.btn-sm):not(.btn-lg) { min-height: var(--jrb-control-height) !important; }
.admin-wrapper .btn-sm { min-height: var(--jrb-control-height-sm) !important; }
.admin-wrapper .btn-lg { min-height: var(--jrb-control-height-lg) !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0ms !important;
    }
}

/* Owner-edited page copy (page_content, 2026-10-22). A long unbroken string
   (URL, code, pasted token) must wrap inside its column instead of widening
   the page. Only elements rendered from saved content carry this class. */
.jrb-content-text { overflow-wrap: anywhere; }
