/* ============================================================
   NOVA VISION MEDIATECH — Search Styling
   File: assets/search.css
   
   Styles for:
   - Header search bar
   - Search dropdown/autocomplete
   - Search results page
============================================================ */

/* ───────────────────────────────────────────────────────── */
/* HEADER SEARCH BAR                                        */
/* ───────────────────────────────────────────────────────── */

.nav-search {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 6px 12px;
    margin-right: 20px;
    transition: all 0.3s ease;
    flex: 0 1 250px;
}

.nav-search:hover,
.nav-search:focus-within {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.nav-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 6px 8px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.nav-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.nav-search-input::-webkit-search-cancel-button {
    display: none;
}

.nav-search-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-search-btn:hover {
    color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* ───────────────────────────────────────────────────────── */
/* SEARCH DROPDOWN / AUTOCOMPLETE                           */
/* ───────────────────────────────────────────────────────── */

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 400px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-dropdown-content {
    max-height: 500px;
    overflow-y: auto;
}

.search-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.search-dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}

.search-dropdown-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.search-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* ───────────────────────────────────────────────────────── */
/* SUGGESTION GROUPS                                        */
/* ───────────────────────────────────────────────────────── */

.search-suggestion-group {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
}

.search-suggestion-group:last-child {
    border-bottom: none;
}

.search-suggestion-label {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ───────────────────────────────────────────────────────── */
/* SUGGESTION ITEMS                                         */
/* ───────────────────────────────────────────────────────── */

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-suggestion-item:hover,
.search-suggestion-item.selected {
    background: var(--accent-alpha);
    color: var(--accent);
}

.search-suggestion-item.selected {
    background: var(--accent-alpha);
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.search-item-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.search-item-content {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-desc {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ───────────────────────────────────────────────────────── */
/* SPELLING CORRECTION HINT                                 */
/* ───────────────────────────────────────────────────────── */

.search-suggestion-hint {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent-alpha), rgba(var(--accent-rgb), 0.05));
    border-left: 3px solid var(--accent);
    font-size: 12px;
    color: var(--text);
}

.search-suggestion-hint strong {
    color: var(--accent);
}

.search-correction-link {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
    transition: all 0.2s ease;
}

.search-correction-link:hover {
    opacity: 0.8;
}

/* ───────────────────────────────────────────────────────── */
/* SUGGESTION FOOTER                                        */
/* ───────────────────────────────────────────────────────── */

.search-suggestion-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.search-view-all {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
}

.search-view-all:hover {
    opacity: 0.8;
}

/* ───────────────────────────────────────────────────────── */
/* RESPONSIVE DESIGN                                        */
/* ───────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .nav-search {
        flex: 0 1 200px;
    }

    .search-dropdown {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .nav-search {
        flex: 0 1 160px;
        margin-right: 10px;
    }

    .nav-search-input {
        font-size: 12px;
    }

    .search-dropdown {
        max-width: calc(100vw - 40px);
        left: 50%;
        transform: translateX(-50%);
        top: 100%;
    }

    .search-suggestion-item {
        padding: 8px 12px;
        gap: 10px;
    }

    .search-item-title {
        font-size: 12px;
    }

    .search-item-desc {
        font-size: 10px;
    }

    .search-item-icon {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .nav-search {
        flex: 0 1 140px;
        padding: 5px 10px;
    }

    .nav-search-input {
        font-size: 11px;
        padding: 4px 6px;
    }

    .search-suggestion-label {
        padding: 6px 12px;
        font-size: 10px;
    }

    .search-suggestion-item {
        padding: 8px 12px;
        gap: 8px;
    }

    .search-suggestion-hint {
        padding: 10px 12px;
        font-size: 11px;
    }
}

/* ───────────────────────────────────────────────────────── */
/* SEARCH RESULTS PAGE STYLING                              */
/* ───────────────────────────────────────────────────────── */

.search-section {
    padding: 60px 20px;
    background: var(--bg);
    min-height: calc(100vh - 200px);
}

.search-container {
    max-width: 900px;
    margin: 0 auto;
}

.search-form {
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.search-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px 20px;
    font-size: 16px;
    outline: none;
    color: var(--text);
    font-family: inherit;
}

.search-input-wrapper input::placeholder {
    color: var(--muted);
}

.search-input-wrapper button {
    border: none;
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

.search-input-wrapper button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.search-tag {
    display: inline-block;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    cursor: pointer;
}

.search-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-alpha);
}

.search-suggestions {
    text-align: center;
    margin-top: 40px;
}

.search-suggestions p {
    color: var(--muted);
    margin-bottom: 20px;
}

.search-results-wrapper {
    margin-top: 40px;
    animation: slideDown 0.4s ease;
}

.search-results-count {
    font-size: 14px;
    color: var(--muted);
    padding: 0 0 20px 0;
    border-bottom: 1px solid var(--border);
}

.search-correction-hint {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 30px;
    text-align: center;
    animation: slideDown 0.4s ease;
}

.search-correction-hint p {
    color: var(--text);
    margin: 0;
}

.search-correction-hint a {
    color: var(--accent);
    text-decoration: underline;
}

.search-correction-hint span {
    color: var(--muted);
    font-size: 12px;
}

.search-results-group {
    margin-top: 40px;
}

.search-results-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    color: var(--text);
    margin: 0 0 20px 0;
    font-weight: 600;
}

.search-results-group-title .icon {
    font-size: 24px;
}

.search-result-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
}

.search-result-item:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.search-result-item h4 {
    color: var(--accent);
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.search-result-item p {
    color: var(--text);
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.search-match-tag {
    background: var(--accent-alpha);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 6px;
}

.search-no-results {
    text-align: center;
    margin-top: 60px;
    animation: slideDown 0.4s ease;
}

.search-no-results > div:first-child {
    font-size: 60px;
    margin-bottom: 20px;
}

.search-no-results h3 {
    color: var(--text);
    margin-bottom: 10px;
}

.search-no-results p {
    color: var(--muted);
    margin-bottom: 30px;
}

.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* ───────────────────────────────────────────────────────── */
/* RESPONSIVE SEARCH RESULTS                                */
/* ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .search-section {
        padding: 40px 15px;
    }

    .search-input-wrapper input {
        font-size: 14px;
        padding: 12px 15px;
    }

    .search-results-group-title {
        font-size: 16px;
    }

    .search-result-item {
        padding: 15px;
    }

    .search-result-item h4 {
        font-size: 14px;
    }

    .search-results-group {
        margin-top: 25px;
    }
}

@media (max-width: 480px) {
    .search-section {
        padding: 30px 10px;
    }

    .search-input-wrapper {
        padding: 4px;
    }

    .search-input-wrapper input {
        font-size: 13px;
        padding: 10px 12px;
    }

    .search-input-wrapper button {
        padding: 10px 16px;
        border-radius: 6px;
        margin-right: 3px;
    }

    .search-results-group-title {
        font-size: 14px;
    }

    .search-result-item {
        padding: 12px;
        margin-bottom: 10px;
    }

    .search-result-item h4 {
        font-size: 13px;
    }

    .search-result-item p {
        font-size: 13px;
    }
}

/* ───────────────────────────────────────────────────────── */
/* TOGGLE-BASED SEARCH BOX (header.php structure)           */
/* ───────────────────────────────────────────────────────── */

/* Hide the expanded search box by default */
.nav-search-box {
    display: none;
    align-items: center;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface, #1a1a2e);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 6px 10px;
    min-width: 260px;
    z-index: 200;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* Show when .open class is added via JS */
.nav-search-box.open {
    display: flex;
}

/* Toggle button (magnifier icon) */
.nav-search-toggle {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.nav-search-toggle:hover {
    color: #fff;
}

/* Clear (×) button inside box */
.nav-search-clear {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s;
}
.nav-search-clear:hover {
    color: #fff;
}

/* Results container inside the box */
#navSearchResults {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface, #1a1a2e);
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    z-index: 1001;
    max-height: 380px;
    overflow-y: auto;
    display: none;
    animation: slideDown 0.25s ease;
}
