/**
 * Catholic Charities — Live Search Styles
 */

/* ===== SEARCH TOGGLE BUTTON ===== */
#cc-search-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--purple);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 45, 145, 0.35);
    transition: background 0.3s ease, transform 0.2s ease;
}
#cc-search-toggle:hover {
    background: var(--teal);
    transform: scale(1.08);
}
#cc-search-toggle svg {
    pointer-events: none;
}

/* ===== SEARCH OVERLAY ===== */
#cc-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 1;
    transition: opacity 0.25s ease;
}
#cc-search-overlay.cc-search-hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== SEARCH CONTAINER ===== */
#cc-search-container {
    background: white;
    border-radius: 14px;
    width: 90%;
    max-width: 640px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
    transform: translateY(0);
    transition: transform 0.25s ease;
}
#cc-search-overlay.cc-search-hidden #cc-search-container {
    transform: translateY(-20px);
}

/* ===== CLOSE BUTTON ===== */
#cc-search-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    z-index: 2;
}
#cc-search-close:hover {
    color: var(--darkgray);
    background: var(--lightgray);
}

/* ===== INPUT AREA ===== */
#cc-search-input-wrap {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--lightgray);
    gap: 12px;
}
#cc-search-input-wrap svg {
    color: var(--gray);
    flex-shrink: 0;
}
#cc-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 17px;
    font-family: inherit;
    color: var(--darkgray);
    background: transparent;
    line-height: 1.4;
}
#cc-search-input::placeholder {
    color: var(--gray);
}

/* ===== RESULTS AREA ===== */
#cc-search-results {
    max-height: 0;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}
#cc-search-results.cc-search-has-results {
    max-height: 55vh;
}

/* Loading state */
.cc-search-loading,
.cc-search-empty {
    padding: 24px 20px;
    text-align: center;
    color: var(--gray);
    font-size: 15px;
}

/* ===== INDIVIDUAL RESULT ===== */
.cc-search-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--lightgray);
    transition: background 0.15s ease;
}
.cc-search-result:hover,
.cc-search-result.cc-search-active {
    background: var(--tan);
}
.cc-search-result:last-of-type {
    border-bottom: none;
}

/* Thumbnail */
.cc-search-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: var(--lightgray);
    flex-shrink: 0;
}
.cc-search-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
}

/* Info column */
.cc-search-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cc-search-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--teal);
}
.cc-search-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--darkgray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-search-excerpt {
    font-size: 13px;
    color: var(--gray);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* "View all" link */
.cc-search-view-all {
    display: block;
    text-align: center;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--purple);
    text-decoration: none;
    border-top: 1px solid var(--lightgray);
    transition: background 0.15s ease;
}
.cc-search-view-all:hover {
    background: var(--tan);
    color: var(--teal);
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 767px) {
    #cc-search-overlay {
        padding-top: 5vh;
    }
    #cc-search-container {
        width: 95%;
        border-radius: 12px;
    }
    #cc-search-input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }
    .cc-search-thumb {
        width: 44px;
        height: 44px;
    }
    .cc-search-result {
        padding: 10px 16px;
        gap: 10px;
    }
    .cc-search-title {
        font-size: 14px;
    }
    .cc-search-excerpt {
        -webkit-line-clamp: 1;
    }
}

/* ===== KEYBOARD SHORTCUT HINT (desktop only) ===== */
@media (min-width: 768px) {
    #cc-search-toggle::after {
        content: '';
    }
}
