/* =============================================
   Dropdown Search Plugin
   ============================================= */

/* Body scroll lock when search is open */
body.ds-search-open {
    overflow: hidden;
}

/* ---- Overlay (click-outside backdrop) ---- */
.ds-dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.3s ease;
}

.ds-dropdown-overlay.ds-visible {
    display: block;
}

.ds-dropdown-overlay.ds-animate-in {
    background-color: rgba(0, 0, 0, 0.5);
}

/* ---- Dropdown Panel ---- */
.ds-dropdown-panel {
    position: absolute;
    top: 90px;
    left: 0;
    width: 100%;
    background-color: #000000e3;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ds-animate-in .ds-dropdown-panel {
    transform: translateY(0);
    opacity: 1;
}

/* ---- Inner container (1200px centered) ---- */
.ds-dropdown-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 20px;
}

/* ---- Search input wrapper ---- */
.ds-search-input-wrap {
    display: flex;
    align-items: center;
    border: none;
    padding-bottom: 12px;
    margin-bottom: 0;
}

/* Search icon */
.ds-search-icon {
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Search input */
.ds-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #ffffff;
    font-family: "Figtree3", "Figtree", sans-serif;
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 0;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.ds-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-family: "Figtree3", "Figtree", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ds-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    display: none;
}

/* Close button */
.ds-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    margin-left: 10px;
    flex-shrink: 0;
    transition: color 0.2s ease;
    line-height: 1;
}

.ds-close-btn:hover,
.ds-close-btn:focus {
    color: #ffffff;
    outline: none;
}

/* ---- Results area ---- */
.ds-results-wrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Expand when results are present — JS adds this class */
.ds-results-wrap.ds-has-content {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

/* Scrollbar styling */
.ds-results-wrap::-webkit-scrollbar {
    width: 6px;
}

.ds-results-wrap::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.ds-results-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.ds-results-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Results list */
.ds-results-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Individual result item */
.ds-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #ffffff;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    cursor: pointer;
    gap: 15px;
}

.ds-result-item:hover,
.ds-result-item.ds-active {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    color: #ffffff;
}

.ds-result-item:focus {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: -2px;
}

/* Result thumbnail */
.ds-result-thumb {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
}

.ds-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Result content */
.ds-result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Result title */
.ds-result-title {
    font-family: "Figtree3", "Figtree", sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Result meta (post type badge) */
.ds-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-result-type {
    display: inline-block;
    font-family: "Figtree3", "Figtree", sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 20px;
    line-height: 1.3;
}

/* Post type badge colors */
.ds-result-type[data-type="speaker"] {
    background-color: rgba(96, 91, 229, 0.35);
    color: #b4b1ff;
    border: 1px solid rgba(96, 91, 229, 0.5);
}

.ds-result-type[data-type="post"] {
    background-color: rgba(236, 100, 45, 0.3);
    color: #ffb896;
    border: 1px solid rgba(236, 100, 45, 0.45);
}

.ds-result-type[data-type="speech"] {
    background-color: rgba(0, 200, 150, 0.25);
    color: #7aecd1;
    border: 1px solid rgba(0, 200, 150, 0.4);
}

/* Fallback for other post types */
.ds-result-type[data-type="other"] {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Result excerpt */
.ds-result-excerpt {
    font-family: "Figtree3", "Figtree", sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Loading and No Results states ---- */
.ds-loading,
.ds-no-results {
    font-family: "Figtree3", "Figtree", sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px 15px;
    text-align: center;
}

/* Loading spinner */
.ds-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: ds-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes ds-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Tablet ---- */
@media (max-width: 1024px) {
    .ds-dropdown-panel {
        top: 90px;
    }

    .ds-dropdown-inner {
        max-width: 100%;
        padding: 25px 30px 15px;
    }

    .ds-search-input {
        font-size: 22px;
    }
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .ds-dropdown-panel {
        top: 60px;
    }

    .ds-dropdown-inner {
        padding: 20px 15px 15px;
    }

    .ds-search-input {
        font-size: 18px;
    }

    .ds-search-input::placeholder {
        font-size: 16px;
    }

    .ds-result-thumb {
        width: 40px;
        height: 40px;
    }

    .ds-result-item {
        padding: 10px 10px;
        gap: 10px;
    }

    .ds-result-title {
        font-size: 14px;
    }

    .ds-result-excerpt {
        display: none;
    }

    .ds-results-wrap.ds-has-content {
        max-height: 300px;
    }
}
