/**
 * OLO Booking — Design Tokens
 * Unified design system tokens for all modules (real-estate, accommodation,
 * appointments, rentals, events). Loaded once per page on frontend.
 *
 * Token naming: --olo-{category}-{name}-{variant}
 * Categories: color, space, radius, shadow, font, ease, z
 */

:root {
    /* ── Brand / Primary ── */
    --olo-color-primary:          #2563EB;
    --olo-color-primary-hover:    #1D4ED8;
    --olo-color-primary-soft:     #DBEAFE;
    --olo-color-primary-contrast: #FFFFFF;

    /* ── Status ── */
    --olo-color-success:          #059669;
    --olo-color-success-soft:     #D1FAE5;
    --olo-color-warning:          #F59E0B;
    --olo-color-warning-soft:     #FEF3C7;
    --olo-color-danger:           #DC2626;
    --olo-color-danger-soft:      #FEE2E2;
    --olo-color-info:             #0EA5E9;
    --olo-color-info-soft:        #E0F2FE;

    /* ── Surfaces ── */
    --olo-color-bg:               #FFFFFF;
    --olo-color-bg-alt:           #F9FAFB;
    --olo-color-surface:          #FFFFFF;
    --olo-color-surface-alt:      #F3F4F6;
    --olo-color-muted:            #F3F4F6;

    /* ── Text ── */
    --olo-color-text:             #111827;
    --olo-color-text-soft:        #374151;
    --olo-color-text-muted:       #6B7280;
    --olo-color-text-faint:       #9CA3AF;
    --olo-color-text-inverse:     #FFFFFF;

    /* ── Borders ── */
    --olo-color-border:           #E5E7EB;
    --olo-color-border-strong:    #D1D5DB;
    --olo-color-border-focus:     #2563EB;

    /* ── Listing status colors (shared across modules) ── */
    --olo-color-badge-sale:       #2563EB;
    --olo-color-badge-rent:       #059669;
    --olo-color-badge-both:       #7C3AED;
    --olo-color-badge-sold:       #DC2626;
    --olo-color-badge-reserved:   #F59E0B;
    --olo-color-badge-rented:     #6B7280;

    /* ── Energy class (real-estate, rentals) ── */
    --olo-color-energy-a:         #00873E;
    --olo-color-energy-b:         #79B752;
    --olo-color-energy-c:         #C3D545;
    --olo-color-energy-d:         #FFF200;
    --olo-color-energy-e:         #FCBD00;
    --olo-color-energy-f:         #F07D00;
    --olo-color-energy-g:         #CC0001;

    /* ── Spacing scale (8pt) ── */
    --olo-space-1:  4px;
    --olo-space-2:  8px;
    --olo-space-3:  12px;
    --olo-space-4:  16px;
    --olo-space-5:  20px;
    --olo-space-6:  24px;
    --olo-space-8:  32px;
    --olo-space-10: 40px;
    --olo-space-12: 48px;
    --olo-space-16: 64px;

    /* ── Radius scale ── */
    --olo-radius-xs: 4px;
    --olo-radius-sm: 6px;
    --olo-radius-md: 8px;
    --olo-radius-lg: 12px;
    --olo-radius-xl: 16px;
    --olo-radius-2xl: 24px;
    --olo-radius-pill: 9999px;

    /* ── Shadows ── */
    --olo-shadow-none: none;
    --olo-shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --olo-shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
    --olo-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.06);
    --olo-shadow-lg: 0 10px 25px rgba(16, 24, 40, 0.10), 0 4px 10px rgba(16, 24, 40, 0.05);
    --olo-shadow-xl: 0 20px 40px rgba(16, 24, 40, 0.12);
    --olo-shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.35);

    /* ── Typography ── */
    --olo-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --olo-font-size-xs: 11px;
    --olo-font-size-sm: 13px;
    --olo-font-size-base: 14px;
    --olo-font-size-md: 16px;
    --olo-font-size-lg: 18px;
    --olo-font-size-xl: 22px;
    --olo-font-size-2xl: 28px;
    --olo-font-size-3xl: 36px;
    --olo-line-tight:  1.2;
    --olo-line-snug:   1.35;
    --olo-line-normal: 1.5;
    --olo-line-relaxed:1.7;

    /* ── Easing ── */
    --olo-ease-out:    cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --olo-ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);
    --olo-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Duration ── */
    --olo-dur-fast:    0.15s;
    --olo-dur-base:    0.25s;
    --olo-dur-slow:    0.4s;

    /* ── Z-index scale ── */
    --olo-z-base:    1;
    --olo-z-overlay: 10;
    --olo-z-dropdown: 50;
    --olo-z-modal:   100;
    --olo-z-toast:   200;
}

/* ── Dark scheme support (opt-in via [data-olo-theme="dark"] or prefers-color-scheme) ── */
@media (prefers-color-scheme: dark) {
    :root[data-olo-theme="auto"] {
        --olo-color-bg:           #0F172A;
        --olo-color-bg-alt:       #1E293B;
        --olo-color-surface:      #1E293B;
        --olo-color-surface-alt:  #334155;
        --olo-color-muted:        #334155;
        --olo-color-text:         #F1F5F9;
        --olo-color-text-soft:    #CBD5E1;
        --olo-color-text-muted:   #94A3B8;
        --olo-color-text-faint:   #64748B;
        --olo-color-border:       #334155;
        --olo-color-border-strong:#475569;
    }
}

:root[data-olo-theme="dark"] {
    --olo-color-bg:           #0F172A;
    --olo-color-bg-alt:       #1E293B;
    --olo-color-surface:      #1E293B;
    --olo-color-surface-alt:  #334155;
    --olo-color-muted:        #334155;
    --olo-color-text:         #F1F5F9;
    --olo-color-text-soft:    #CBD5E1;
    --olo-color-text-muted:   #94A3B8;
    --olo-color-text-faint:   #64748B;
    --olo-color-border:       #334155;
    --olo-color-border-strong:#475569;
}

/* ── Shared baseline for all tiles (set via body class or wrapper) ── */
.olo-tile {
    container-type: inline-size;
    font-family: var(--olo-font-sans);
    color: var(--olo-color-text);
    box-sizing: border-box;
}

.olo-tile *,
.olo-tile *::before,
.olo-tile *::after {
    box-sizing: inherit;
}

.olo-tile :focus-visible {
    outline: 2px solid var(--olo-color-border-focus);
    outline-offset: 2px;
    border-radius: var(--olo-radius-xs);
}

/* ── Reduced motion: disable all transitions/animations/transforms on hover ── */
@media (prefers-reduced-motion: reduce) {
    .olo-tile *,
    .olo-tile *::before,
    .olo-tile *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
    .olo-tile *:hover {
        transform: none !important;
    }
}

/* ── Utility: visually hidden but accessible to screen readers ── */
.olo-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------------ *
 *  Public favorites — heart button on property tiles
 * ------------------------------------------------------------------ */
.olo-pe-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #374151;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    line-height: 0;
}
.olo-pe-fav:hover {
    transform: scale(1.1);
    background: #fff;
}
.olo-pe-fav:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}
.olo-pe-fav svg {
    pointer-events: none;
    transition: fill 0.2s ease, stroke 0.2s ease;
}
.olo-pe-fav.is-active {
    color: #DC2626;
}
.olo-pe-fav.is-active svg {
    fill: currentColor;
    stroke: currentColor;
}
.olo-pe-fav.is-animating {
    animation: olo-pe-fav-pulse 0.4s ease;
}
@keyframes olo-pe-fav-pulse {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .olo-pe-fav,
    .olo-pe-fav:hover,
    .olo-pe-fav.is-animating {
        transition: none;
        animation: none;
    }
}

/* Save-search icon button — paired to the search submit in search tiles. */
.olo-pe-save-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    background: #fff;
    color: #2563EB;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    line-height: 0;
}
.olo-pe-save-search:hover {
    background: #2563EB;
    color: #fff;
    transform: translateY(-1px);
}
.olo-pe-save-search:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}
.olo-pe-save-search svg { pointer-events: none; }

/* Mini-dialog for Save Search */
.olo-pe-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.olo-pe-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: min(420px, 100%);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    font-family: inherit;
}
.olo-pe-dialog h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}
.olo-pe-dialog p { margin: 0 0 16px; color: #4B5563; font-size: 14px; }
.olo-pe-dialog label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.olo-pe-dialog input[type="text"],
.olo-pe-dialog select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #F9FAFB;
    margin-bottom: 14px;
    box-sizing: border-box;
}
.olo-pe-dialog__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}
.olo-pe-dialog__btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: 0;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.olo-pe-dialog__btn--primary { background: #2563EB; color: #fff; }
.olo-pe-dialog__btn--primary:hover { background: #1E40AF; }
.olo-pe-dialog__btn--ghost   { background: transparent; color: #6B7280; }
.olo-pe-dialog__btn--ghost:hover { color: #111827; }

.olo-pe-toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.olo-pe-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.olo-pe-toast--error { background: #DC2626; }
.olo-pe-toast--success { background: #059669; }

