/**
 * Search Modal — eduardoreisaraujo.com.br
 * Funciona em: index.html, indicadores.html, ensino/*
 * Design alinhado com o sistema editorial do site (Playfair Display + Source Sans 3)
 */

/* =====================================================
   Botão de busca — ensino pages (notas.css não tem)
   ===================================================== */
.header-right-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #9A9A9A;
    padding: 0.375rem;
    margin: -0.375rem;
    transition: color 0.2s ease;
    flex-shrink: 0;
    line-height: 0;
}

.header-search-btn:hover {
    color: #1D1D1B;
}

/* =====================================================
   Overlay
   ===================================================== */
.srch-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5rem 1rem 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.srch-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 640px) {
    .srch-overlay {
        padding: 0;
        align-items: flex-start;
    }
}

/* =====================================================
   Container
   ===================================================== */
.srch-container {
    background: #ffffff;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e5e5;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.06);
}

@media (max-width: 640px) {
    .srch-container {
        max-width: 100%;
        max-height: 100dvh;
        border-left: none;
        border-right: none;
        border-top: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    }
}

/* =====================================================
   Input row
   ===================================================== */
.srch-input-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0 1rem;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.srch-icon {
    flex-shrink: 0;
    color: #aaa;
}

.srch-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    padding: 1rem 0;
    color: #1a1a1a;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}

.srch-input::-webkit-search-cancel-button,
.srch-input::-webkit-search-decoration {
    display: none;
}

.srch-input::placeholder {
    color: #c0c0c0;
}

.srch-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    padding: 0.375rem;
    margin: -0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 0;
}

.srch-close:hover {
    color: #1a1a1a;
}

/* =====================================================
   Results area
   ===================================================== */
.srch-results {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* =====================================================
   Empty / initial state
   ===================================================== */
.srch-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #bbb;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.srch-empty strong {
    color: #888;
}

/* =====================================================
   Section group header
   ===================================================== */
.srch-group-header {
    padding: 0.875rem 1.5rem 0.375rem;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #bbb;
    border-top: 1px solid #f2f2f2;
}

.srch-group-header:first-child {
    border-top: none;
}

/* =====================================================
   Result item
   ===================================================== */
.srch-result {
    display: block;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s ease;
    outline: none;
}

.srch-result:last-child {
    border-bottom: none;
}

.srch-result:hover,
.srch-result.focused {
    background: #fafafa;
}

.srch-result-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.35;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.srch-result-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.srch-badge {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #999;
}

.srch-date {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8125rem;
    color: #bbb;
}

.srch-result-excerpt {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    color: #777;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =====================================================
   Highlight mark
   ===================================================== */
.srch-result mark {
    background: #fff3cd;
    color: inherit;
    border-radius: 1px;
    font-style: inherit;
    padding: 0 1px;
}

/* =====================================================
   Footer hints
   ===================================================== */
.srch-footer {
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: #fafafa;
}

.srch-hint {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.75rem;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.srch-kbd {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #ddd;
    border-bottom-width: 2px;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.6875rem;
    font-family: 'Source Sans 3', monospace;
    color: #aaa;
    line-height: 1.5;
}
