/* ============================================================
   TaxTami Search Modal — green-themed overlay search experience
   ============================================================ */

.tt-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 50, 35, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px 20px;
    box-sizing: border-box;
    overflow-y: auto;
}
.tt-search-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.tt-search-panel {
    width: 100%;
    max-width: 760px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 180ms ease;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
}
.tt-search-overlay.is-open .tt-search-panel { transform: translateY(0); }

.tt-search-header {
    background: #1a5038;
    color: #ffffff;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.tt-search-header .tt-search-icon {
    color: #ffffff;
    font-size: 22px;
    flex-shrink: 0;
}
.tt-search-input {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.15rem;
    font-family: 'Work Sans', Heebo, sans-serif;
    padding: 6px 0;
    outline: none;
    min-width: 0;
}
.tt-search-input::placeholder { color: rgba(255,255,255,0.65); }
.tt-search-close {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Work Sans', sans-serif;
    letter-spacing: 0.04em;
}
.tt-search-close:hover { background: rgba(255,255,255,0.28); }

.tt-search-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    overflow-x: auto;
    border-bottom: 1px solid #e6ebe8;
    background: #f4faf7;
}
.tt-search-chip {
    background: #ffffff;
    border: 1.5px solid #c5ddd0;
    color: #1a5038;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    font-family: 'Work Sans', sans-serif;
}
.tt-search-chip:hover { background: #e8f3ec; }
.tt-search-chip.is-active {
    background: #2c724f;
    color: #ffffff;
    border-color: #2c724f;
}

.tt-search-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 0;
}

.tt-search-empty {
    padding: 28px 24px;
    color: #4a5853;
    font-size: 0.92rem;
    font-family: 'Work Sans', sans-serif;
}
.tt-search-empty h4 {
    color: #1a5038;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 18px 0 8px;
    font-family: 'Work Sans', sans-serif;
}
.tt-search-empty ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tt-search-empty ul li a {
    display: inline-block;
    padding: 6px 12px;
    background: #f4faf7;
    border: 1px solid #c5ddd0;
    border-radius: 6px;
    color: #1a5038;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}
.tt-search-empty ul li a:hover { background: #e8f3ec; }

.tt-search-group { padding: 6px 0; }
.tt-search-group-header {
    padding: 10px 24px 6px;
    color: #2c724f;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Work Sans', sans-serif;
}

.tt-search-result {
    display: block;
    padding: 12px 24px;
    border-left: 3px solid transparent;
    color: #2a3530;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease, border-left-color 0.12s ease;
    font-family: 'Work Sans', sans-serif;
}
.tt-search-result:hover,
.tt-search-result.is-active {
    background: #f4faf7;
    border-left-color: #2c724f;
    text-decoration: none;
}
.tt-search-result-title {
    color: #1a5038;
    font-size: 0.98rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.tt-search-result-title mark {
    background: rgba(201, 122, 55, 0.22);
    color: #1a5038;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 800;
}
.tt-search-result-meta {
    color: #6b7670;
    font-size: 0.74rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.tt-search-result-meta .tt-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.tt-badge.tt-badge-itc     { background: #e8f3ec; color: #1a5038; }
.tt-badge.tt-badge-vat     { background: #fff7ed; color: #b45309; }
.tt-badge.tt-badge-cgt     { background: #eef2ff; color: #3730a3; }
.tt-badge.tt-badge-debt    { background: #fef2f2; color: #991b1b; }
.tt-badge.tt-badge-tarms   { background: #f0fdf4; color: #166534; }
.tt-badge.tt-badge-customs { background: #f5f3ff; color: #5b21b6; }
.tt-badge.tt-badge-misc    { background: #f3f4f6; color: #374151; }
.tt-badge.tt-badge-type {
    background: #1a5038;
    color: #ffffff;
}
.tt-search-result-excerpt {
    color: #4a5853;
    font-size: 0.86rem;
    line-height: 1.45;
}
.tt-search-result-excerpt mark {
    background: rgba(201, 122, 55, 0.22);
    color: #1a5038;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

.tt-search-no-results {
    padding: 36px 24px;
    text-align: center;
    color: #6b7670;
    font-size: 0.92rem;
    font-family: 'Work Sans', sans-serif;
}
.tt-search-no-results strong {
    display: block;
    color: #1a5038;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.tt-search-footer {
    padding: 10px 20px;
    border-top: 1px solid #e6ebe8;
    background: #f4faf7;
    font-size: 0.72rem;
    color: #6b7670;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.tt-search-footer kbd {
    background: #ffffff;
    border: 1px solid #c5ddd0;
    border-radius: 3px;
    padding: 1px 5px;
    font-family: monospace;
    font-size: 0.7rem;
    color: #1a5038;
    margin: 0 2px;
}

@media (max-width: 640px) {
    .tt-search-overlay { padding: 20px 8px; }
    .tt-search-header { padding: 14px 16px; gap: 10px; }
    .tt-search-input { font-size: 1.02rem; }
    .tt-search-result { padding: 10px 16px; }
    .tt-search-group-header { padding: 8px 16px 4px; }
    .tt-search-footer { display: none; }
}


/* ── Floating search button (fallback for pages without inline button) ── */
#tt-floating-search {
    position: fixed;
    top: 90px;
    right: 22px;
    z-index: 9998;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1a5038;
    color: #ffffff;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(20,50,35,0.25);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    padding: 0;
}
#tt-floating-search:hover {
    background: #2c724f;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(20,50,35,0.32);
}
#tt-floating-search:focus {
    outline: 2px solid #fef6e4;
    outline-offset: 3px;
}
@media (max-width: 640px) {
    #tt-floating-search { top: auto; bottom: 22px; right: 16px; width: 44px; height: 44px; }
}


/* ── Hide native header search button — replaced by floating circle ── */
.search-box-btn,
.search-box-outer,
.main-header .search-box-btn,
.main-header .header-upper .search-box-btn,
.main-header .header-upper .search-box-outer {
    display: none !important;
}
/* Hide the legacy form-based search popup — replaced by the modal */
.search-popup {
    display: none !important;
}

/* ── v2: animated pulse on the floating button ── */
@keyframes tt-pulse {
    0%   { box-shadow: 0 6px 18px rgba(20,50,35,0.25), 0 0 0 0   rgba(44,114,79,0.55); }
    70%  { box-shadow: 0 6px 18px rgba(20,50,35,0.25), 0 0 0 18px rgba(44,114,79,0); }
    100% { box-shadow: 0 6px 18px rgba(20,50,35,0.25), 0 0 0 0   rgba(44,114,79,0); }
}
#tt-floating-search.is-pulsing {
    animation: tt-pulse 1.8s ease-out 3;
}

/* ── v2: tooltip on hover ── */
#tt-floating-search[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1a5038;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    font-family: 'Work Sans', sans-serif;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 12px rgba(20,50,35,0.25);
}
#tt-floating-search[data-tooltip]::before {
    content: '';
    position: absolute;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    border-style: solid;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #1a5038;
    opacity: 0;
    transition: opacity 180ms ease;
    pointer-events: none;
}
#tt-floating-search:hover[data-tooltip]::after,
#tt-floating-search:hover[data-tooltip]::before,
#tt-floating-search:focus[data-tooltip]::after,
#tt-floating-search:focus[data-tooltip]::before {
    opacity: 1;
}
@media (max-width: 640px) {
    #tt-floating-search[data-tooltip]::after,
    #tt-floating-search[data-tooltip]::before {
        display: none;
    }
}

/* ── v2: type-ahead autocomplete dropdown ── */
.tt-autocomplete {
    border-bottom: 1px solid #e6ebe8;
    padding: 8px 0 12px;
    background: #f9fcfa;
}
.tt-autocomplete-label {
    padding: 4px 24px 6px;
    color: #2c724f;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: 'Work Sans', sans-serif;
}
.tt-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 24px;
    color: #1a5038;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: background 0.12s ease;
    font-family: 'Work Sans', sans-serif;
}
.tt-autocomplete-item:hover {
    background: #e8f3ec;
    text-decoration: none;
}
.tt-autocomplete-item .tt-autocomplete-icon {
    color: #c97a37;
    font-size: 0.95rem;
    flex-shrink: 0;
    font-weight: 700;
}
.tt-autocomplete-item .tt-autocomplete-type {
    margin-left: auto;
    color: #6b7670;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

/* ── v2: "Did you mean?" banner ── */
.tt-did-you-mean {
    padding: 12px 24px;
    background: #fff7ed;
    border-left: 4px solid #c97a37;
    color: #1a5038;
    font-size: 0.92rem;
    margin: 0 0 8px;
    font-family: 'Work Sans', sans-serif;
}
.tt-did-you-mean a {
    color: #1a5038;
    font-weight: 700;
    text-decoration: underline;
}

/* ── v2: hover preview card ── */
.tt-result-preview {
    position: fixed;
    width: 360px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border: 1px solid #c5ddd0;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(20,50,35,0.18);
    padding: 14px 16px;
    font-size: 0.85rem;
    color: #2a3530;
    line-height: 1.5;
    z-index: 100000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 160ms ease, transform 160ms ease;
    font-family: 'Work Sans', sans-serif;
}
.tt-result-preview.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.tt-result-preview-inner {
    max-height: 220px;
    overflow: hidden;
}
@media (max-width: 991px) {
    .tt-result-preview { display: none !important; }
}

/* ── v2: clear-recent link in empty state ── */
.tt-search-empty h4 .tt-clear-recent:hover {
    color: #1a5038;
    text-decoration: underline;
}

/* ── v2: kbd styling in the body intro ── */
.tt-search-empty kbd {
    background: #ffffff;
    border: 1px solid #c5ddd0;
    border-radius: 3px;
    padding: 1px 5px;
    font-family: monospace;
    font-size: 0.78rem;
    color: #1a5038;
    margin: 0 2px;
}

/* ── v3: voice search mic button ── */
.tt-search-mic {
    background: rgba(255,255,255,0.16);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
    margin-right: 6px;
}
.tt-search-mic:hover { background: rgba(255,255,255,0.28); }
.tt-search-mic.is-listening {
    background: #c97a37;
    animation: tt-mic-pulse 1s ease-in-out infinite;
}
@keyframes tt-mic-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(201,122,55,0.55); }
    50%      { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(201,122,55,0); }
}

/* ── v3: statute / calculator jump card ── */
.tt-jump-card {
    display: block;
    background: linear-gradient(135deg, #1a5038 0%, #2c724f 100%);
    color: #ffffff;
    padding: 16px 22px;
    margin: 10px 16px 14px;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(20,50,35,0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-left: 4px solid #c97a37;
}
.tt-jump-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(20,50,35,0.26);
    text-decoration: none;
}
.tt-jump-card-label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fef6e4;
    margin-bottom: 4px;
}
.tt-jump-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #ffffff;
}
.tt-jump-card-meta {
    font-size: 0.86rem;
    color: #d6ede2;
}
.tt-jump-card-meta strong { color: #fef6e4; font-weight: 700; }
.tt-jump-card-calc {
    background: linear-gradient(135deg, #c97a37 0%, #b45309 100%);
    border-left-color: #fef6e4;
}
.tt-jump-card-calc .tt-jump-card-label { color: #fff7ed; }

/* ── v3: quick filter chip divider + variant ── */
.tt-chip-divider {
    width: 1px;
    height: 22px;
    background: #c5ddd0;
    align-self: center;
    margin: 0 4px;
    flex-shrink: 0;
}
.tt-search-chip.tt-chip-quick {
    background: #ffffff;
    border-color: #d6ede2;
    color: #2c724f;
}
.tt-search-chip.tt-chip-quick:hover {
    background: #f4faf7;
}
.tt-search-chip.tt-chip-quick.is-active {
    background: #c97a37;
    color: #ffffff;
    border-color: #c97a37;
}

/* ── v4: AI-style answer card ── */
.tt-answer-card {
    background: linear-gradient(135deg, #f0f7f3 0%, #e8f3ec 100%);
    border: 1px solid #c5ddd0;
    border-left: 4px solid #2c724f;
    padding: 16px 22px;
    margin: 10px 16px 14px;
    border-radius: 10px;
    color: #1a3a2a;
}
.tt-answer-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #2c724f;
    margin-bottom: 6px;
    font-family: 'Work Sans', sans-serif;
}
.tt-answer-icon { color: #c97a37; margin-right: 4px; }
.tt-answer-body {
    font-size: 0.94rem;
    line-height: 1.5;
    color: #1a3a2a;
    margin-bottom: 8px;
}
.tt-answer-sources {
    font-size: 0.78rem;
    color: #4a5853;
}
.tt-answer-sources a {
    color: #1a5038;
    font-weight: 600;
    text-decoration: underline;
}

/* ── v4: result wrap (bookmark star + result link) ── */
.tt-search-result-wrap {
    position: relative;
    display: flex;
    align-items: flex-start;
}
.tt-search-result-wrap .tt-search-result {
    flex: 1 1 auto;
    min-width: 0;
}
.tt-bookmark-star {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #cfd8d3;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin: 14px 4px 0 8px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
    line-height: 1;
}
.tt-bookmark-star:hover {
    color: #c97a37;
    background: #fff7ed;
}
.tt-bookmark-star.is-bookmarked {
    color: #c97a37;
}
.tt-bookmark-star.is-bookmarked:hover {
    color: #1a5038;
}

/* ── v4: "Surprise me" action button ── */
.tt-empty-actions {
    margin: 14px 0 6px;
}
.tt-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #c97a37 0%, #b45309 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Work Sans', sans-serif;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(201,122,55,0.22);
}
.tt-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(201,122,55,0.32);
}
.tt-action-btn span { font-size: 1.1rem; }

/* ── v4: bookmark list in empty state ── */
.tt-bookmark-list li a .tt-star {
    color: #c97a37;
    margin-right: 6px;
}

/* ── v4: trending count badge ── */
.tt-trend-count {
    display: inline-block;
    margin-left: 6px;
    background: #e8f3ec;
    color: #2c724f;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ── v4: clear-link utility (shared by recent/bookmarks) ── */
.tt-clear-link {
    float: right;
    font-size: 0.7rem;
    font-weight: 600;
    color: #c97a37;
    text-decoration: none;
    letter-spacing: 0;
    text-transform: none;
}
.tt-clear-link:hover { color: #1a5038; text-decoration: underline; }
