/* ==========================================================================
   Real Estate Category Tools - Shared Theme, Tooltips & Accents
   Category Theme Color: Amber / Warm Gold (#d97706 light, #fbbf24 dark)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Section Eyebrow Labels & Subtitles ("GOOD TO KNOW", "HOW IT WORKS", etc.)
   Overrides health-actions.css rose red (#e11d48) with Real Estate Amber
   -------------------------------------------------------------------------- */
html body.is-tool-page .tool-guide .tg-eyebrow,
html body.is-tool-page .tg-eyebrow,
html body .tool-guide .tg-eyebrow,
html body .tg-eyebrow,
.tool-guide .tg-eyebrow,
.tg-eyebrow,
.ht-eyebrow {
    color: #d97706 !important; /* amber-600 in light mode */
}

html.dark body.is-tool-page .tool-guide .tg-eyebrow,
html.dark body.is-tool-page .tg-eyebrow,
html.dark body .tool-guide .tg-eyebrow,
html.dark body .tg-eyebrow,
html.dark .tool-guide .tg-eyebrow,
html.dark .tg-eyebrow,
.dark .tg-eyebrow,
.dark .ht-eyebrow {
    color: #fbbf24 !important; /* amber-400 in dark mode */
}

/* --------------------------------------------------------------------------
   2. Real Estate Action Toolbar Buttons (Download Report, Share, Copy, Reset)
   Ensures buttons match Real Estate Amber instead of Health Rose
   -------------------------------------------------------------------------- */
html body.is-tool-page .ha-btn-primary,
html body.is-tool-page .ha-btn-primary:hover,
.ha-btn-primary,
.ha-btn-primary:hover {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
}

html body.is-tool-page .ha-btn-primary:hover,
.ha-btn-primary:hover {
    background: #b45309 !important;
    border-color: #b45309 !important;
}

html.dark body.is-tool-page .ha-btn-primary,
html.dark body.is-tool-page .ha-btn-primary:hover {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #09090b !important;
}

html.dark body.is-tool-page .ha-btn-primary:hover {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
}

html body.is-tool-page .ha-btn:hover {
    background: rgba(245, 158, 11, 0.08) !important;
    border-color: #f59e0b !important;
    color: #d97706 !important;
}

html.dark body.is-tool-page .ha-btn:hover {
    color: #fbbf24 !important;
    border-color: #fbbf24 !important;
    background: rgba(245, 158, 11, 0.12) !important;
}

html body.is-tool-page .ha-btn:focus-visible {
    outline: 2px solid #f59e0b !important;
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3. Real Estate FAQ Accordion Active Highlight
   -------------------------------------------------------------------------- */
.faq-card-root.is-active {
    border-color: rgba(245, 158, 11, 0.4) !important;
    box-shadow: 0 4px 20px -4px rgba(245, 158, 11, 0.15), 0 2px 6px -1px rgba(0, 0, 0, 0.04) !important;
}

html.dark .faq-card-root.is-active {
    border-color: rgba(251, 191, 36, 0.35) !important;
    box-shadow: 0 4px 24px -4px rgba(245, 158, 11, 0.2), 0 2px 8px -1px rgba(0, 0, 0, 0.4) !important;
}

.faq-card-root.is-active .faq-toggle-icon {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #d97706 !important;
}

html.dark .faq-card-root.is-active .faq-toggle-icon {
    color: #fbbf24 !important;
}

/* --------------------------------------------------------------------------
   4. Accessible Field Tooltips (Referenced from Health Categories)
   -------------------------------------------------------------------------- */
.ht-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    vertical-align: middle;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: normal !important;
    line-height: 1 !important;
}

.ht-tooltip-wrap:hover,
.ht-tooltip-wrap:focus-within,
.ht-tooltip-wrap.ht-open {
    z-index: 100;
}

.ht-tooltip-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 9999px;
    font-size: 11px;
    line-height: 1;
    transition: color 0.15s ease, transform 0.15s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Generous touch target expansion for mobile */
.ht-tooltip-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 34px;
    min-height: 34px;
    width: 100%;
    height: 100%;
}

.ht-tooltip-btn:hover,
.ht-tooltip-btn:focus-visible,
.ht-tooltip-wrap.ht-open .ht-tooltip-btn {
    color: #f59e0b; /* Amber accent for real estate */
    outline: none;
    transform: scale(1.15);
}

.dark .ht-tooltip-btn {
    color: #71717a;
}

.dark .ht-tooltip-btn:hover,
.dark .ht-tooltip-btn:focus-visible,
.dark .ht-tooltip-wrap.ht-open .ht-tooltip-btn {
    color: #fbbf24;
}

/* Tooltip popup box - strictly hidden by default */
.ht-tooltip-box {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 260px;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    font-weight: 400 !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    white-space: normal !important;
    color: #ffffff !important;
    background: rgba(24, 24, 27, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 1000;
}

/* Pointer arrow */
.ht-tooltip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--ht-arrow-x, 50%);
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(24, 24, 27, 0.96) transparent transparent transparent;
}

/* Flip downwards when positioned near top edge */
.ht-tooltip-box.ht-placement-bottom {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
}

.ht-tooltip-box.ht-placement-bottom::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent rgba(24, 24, 27, 0.96) transparent;
}

/* Left / Right alignment variants */
.ht-tooltip-box.align-left {
    left: 0;
    transform: translateX(0) translateY(4px);
}

.ht-tooltip-box.align-left::after {
    left: var(--ht-arrow-x, 12px);
    transform: none;
}

.ht-tooltip-box.align-right {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
}

.ht-tooltip-box.align-right::after {
    left: auto;
    right: var(--ht-arrow-x, 12px);
    transform: none;
}

/* --------------------------------------------------------------------------
   Bigger Screens (Desktop): Tooltip VISIBLE ON HOVER & KEYBOARD FOCUS
   -------------------------------------------------------------------------- */
@media (hover: hover) and (min-width: 641px) {
    .ht-tooltip-wrap:hover .ht-tooltip-box,
    .ht-tooltip-wrap:focus-within .ht-tooltip-box {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(-50%) translateY(0) !important;
        pointer-events: auto !important;
    }

    .ht-tooltip-wrap:hover .ht-tooltip-box.align-left,
    .ht-tooltip-wrap:focus-within .ht-tooltip-box.align-left {
        transform: translateX(0) translateY(0) !important;
    }

    .ht-tooltip-wrap:hover .ht-tooltip-box.align-right,
    .ht-tooltip-wrap:focus-within .ht-tooltip-box.align-right {
        transform: translateX(0) translateY(0) !important;
    }

    .ht-tooltip-wrap:hover .ht-tooltip-box.ht-placement-bottom,
    .ht-tooltip-wrap:focus-within .ht-tooltip-box.ht-placement-bottom {
        transform: translateX(-50%) translateY(0) !important;
    }
}

/* --------------------------------------------------------------------------
   Smaller Screens (Mobile): Tooltip VISIBLE ON CLICK (.ht-open)
   -------------------------------------------------------------------------- */
.ht-tooltip-wrap.ht-open .ht-tooltip-box {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) translateY(0) !important;
    pointer-events: auto !important;
}

.ht-tooltip-wrap.ht-open .ht-tooltip-box.align-left {
    transform: translateX(0) translateY(0) !important;
}

.ht-tooltip-wrap.ht-open .ht-tooltip-box.align-right {
    transform: translateX(0) translateY(0) !important;
}

.ht-tooltip-wrap.ht-open .ht-tooltip-box.ht-placement-bottom {
    transform: translateX(-50%) translateY(0) !important;
}

/* Mobile responsive dimensions */
@media (max-width: 640px) {
    .ht-tooltip-btn {
        width: 1.15rem;
        height: 1.15rem;
        font-size: 12px;
    }

    .ht-tooltip-box,
    .ht-tooltip-box.align-left,
    .ht-tooltip-box.align-right {
        max-width: min(260px, calc(100vw - 28px)) !important;
        font-size: 0.68rem !important;
        padding: 0.45rem 0.65rem !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) translateY(4px);
    }

    .ht-tooltip-wrap.ht-open .ht-tooltip-box,
    .ht-tooltip-wrap.ht-open .ht-tooltip-box.align-left,
    .ht-tooltip-wrap.ht-open .ht-tooltip-box.align-right {
        transform: translateX(-50%) translateY(0) !important;
    }

    .ht-tooltip-box::after,
    .ht-tooltip-box.align-left::after,
    .ht-tooltip-box.align-right::after {
        left: var(--ht-arrow-x, 50%) !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }
}

/* ==========================================================================
   5. Real Estate Segmented Mode Switchers, Tabs & Action Buttons
   Ensures 100% crisp, readable contrast in both Light & Dark themes
   ========================================================================== */

.re-seg-bar {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem;
    border-radius: 1rem;
    background: rgba(228, 228, 231, 0.85); /* zinc-200/85 */
    border: 1px solid rgba(212, 212, 216, 0.9); /* zinc-300 */
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    gap: 0.25rem;
}

html.dark .re-seg-bar {
    background: #18181b; /* zinc-900 */
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.35);
}

.re-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.75rem; /* text-xs */
    font-weight: 600;
    line-height: 1rem;
    color: #52525b; /* zinc-600 */
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.re-mode-btn i {
    color: #d97706; /* amber-600 */
    font-size: 11px;
    transition: color 0.18s ease;
}

.re-mode-btn:hover {
    color: #09090b; /* zinc-950 */
    background: rgba(0, 0, 0, 0.04);
}

html.dark .re-mode-btn {
    color: #a1a1aa; /* zinc-400 */
    background: transparent;
}

html.dark .re-mode-btn i {
    color: #fbbf24; /* amber-400 */
}

html.dark .re-mode-btn:hover {
    color: #ffffff; /* pure white text on hover */
    background: rgba(255, 255, 255, 0.06);
}

/* Active State in Light Mode: clean, crisp white pill with elevation */
.re-mode-btn.is-active,
.re-mode-btn.active {
    background: #ffffff !important;
    color: #09090b !important;
    font-weight: 700 !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06) !important;
}

.re-mode-btn.is-active i,
.re-mode-btn.active i {
    color: #d97706 !important;
}

/* Active State in Dark Mode: vibrant amber pill with bold dark text */
html.dark .re-mode-btn.is-active,
html.dark .re-mode-btn.active {
    background: #f59e0b !important; /* amber-500 */
    color: #09090b !important;      /* zinc-950 */
    font-weight: 800 !important;
    border-color: #fbbf24 !important;
    box-shadow: 0 2px 10px -2px rgba(245, 158, 11, 0.45) !important;
}

html.dark .re-mode-btn.is-active i,
html.dark .re-mode-btn.active i {
    color: #09090b !important;
}

/* Preset Quick Select Buttons (holding period, duration, yield type) */
.re-preset-btn,
.preset-holding-btn,
.preset-duration-btn,
.preset-yield-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    color: #3f3f46;
}

.re-preset-btn:hover,
.preset-holding-btn:hover,
.preset-duration-btn:hover,
.preset-yield-type:hover {
    background: #e4e4e7;
    color: #09090b;
    border-color: #d4d4d8;
}

html.dark .re-preset-btn,
html.dark .preset-holding-btn,
html.dark .preset-duration-btn,
html.dark .preset-yield-type {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d4d4d8;
}

html.dark .re-preset-btn:hover,
html.dark .preset-holding-btn:hover,
html.dark .preset-duration-btn:hover,
html.dark .preset-yield-type:hover {
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
    background: rgba(255, 255, 255, 0.08);
}

.re-preset-btn.is-active,
.re-preset-btn.active,
.preset-holding-btn.is-active,
.preset-holding-btn.active,
.preset-duration-btn.is-active,
.preset-duration-btn.active,
.preset-yield-type.is-active,
.preset-yield-type.active {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

html.dark .re-preset-btn.is-active,
html.dark .re-preset-btn.active,
html.dark .preset-holding-btn.is-active,
html.dark .preset-holding-btn.active,
html.dark .preset-duration-btn.is-active,
html.dark .preset-duration-btn.active,
html.dark .preset-yield-type.is-active,
html.dark .preset-yield-type.active {
    background: #f59e0b !important;
    border-color: #fbbf24 !important;
    color: #09090b !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 8px -1px rgba(245, 158, 11, 0.35) !important;
}

/* Reference card buttons (sq ft / budget loaders) */
.re-ref-card {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    text-align: left;
    transition: all 0.15s ease-in-out;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    cursor: pointer;
}

.re-ref-card:hover {
    background: #e4e4e7;
    border-color: rgba(217, 119, 6, 0.4);
}

.re-ref-card:active {
    transform: scale(0.97);
}

html.dark .re-ref-card {
    background: rgba(24, 24, 27, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark .re-ref-card:hover {
    background: rgba(39, 39, 42, 0.7);
    border-color: rgba(245, 158, 11, 0.45);
}

