/**
 * TBR Search Overlay - Styles
 * Professional, modern search overlay with animations
 */

/* ================================
   OVERLAY BASE
   ================================ */
.tbr-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    animation: tbrFadeIn 0.3s ease-out;
}

@keyframes tbrFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ================================
   CONTAINER
   ================================ */
.tbr-search-container {
    width: 100%;
    max-width: 900px;
    padding: 4rem 1rem 2rem;
    margin: 0 auto;
    animation: tbrSlideDown 0.3s ease-out;
}

@keyframes tbrSlideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ================================
   HEADER & CLOSE BUTTON
   ================================ */
.tbr-search-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.tbr-search-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbr-search-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* ================================
   SEARCH INPUT
   ================================ */
.tbr-search-input-wrapper {
    position: relative;
    margin-bottom: 3rem;
}

.tbr-search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.tbr-search-input {
    width: 100%;
    padding: 1.25rem 3.5rem 1.25rem 4.5rem;
    font-size: 1.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.tbr-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.tbr-search-input:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.tbr-search-clear {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbr-search-clear:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ================================
   CONTENT AREA
   ================================ */
.tbr-search-content {
    min-height: 200px;
}

/* ================================
   SUGGESTIONS
   ================================ */
.tbr-search-suggestions {
    text-align: center;
}

.tbr-suggestions-title {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.tbr-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    max-width: 700px;
    margin: 0 auto;
}

.tbr-suggestion-item {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    text-decoration: none;
}

.tbr-suggestion-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* ================================
   LOADING STATE
   ================================ */
.tbr-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.7);
}

.tbr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tbrSpin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes tbrSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================
   RESULTS
   ================================ */
.tbr-results-section {
    margin-bottom: 3rem;
}

.tbr-results-title {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.tbr-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.tbr-result-item {
    display: flex;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #fff;
    overflow: hidden;
}

.tbr-result-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tbr-result-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.tbr-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tbr-result-content {
    flex: 1;
    min-width: 0;
}

.tbr-result-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tbr-result-excerpt {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Authors specific */
.tbr-results-authors .tbr-result-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.tbr-result-author .tbr-result-content {
    display: flex;
    align-items: center;
}

.tbr-result-author .tbr-result-title {
    margin: 0;
}

/* ================================
   VIEW MORE BUTTON
   ================================ */
.tbr-results-more {
    text-align: center;
}

.tbr-results-more-single {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tbr-btn-more {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tbr-btn-more:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* ================================
   NO RESULTS & ERROR STATES
   ================================ */
.tbr-search-no-results,
.tbr-search-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

.tbr-search-no-results svg,
.tbr-search-error svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.tbr-search-no-results p,
.tbr-search-error p {
    font-size: 1.125rem;
    margin: 0;
}

/* ================================
   SEARCH TRIGGER (for header)
   ================================ */
.tbr-search-trigger {
    background: transparent;
    border: none;
    color: white !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right:1rem;
}

.tbr-search-trigger:hover {
    opacity: 0.7;
}

.tbr-search-trigger svg {
    width: 24px;
    height: 24px;
}

/* Mobile: Show search icon before hamburger */
.tbr-search-trigger.tbr-search-desktop {
    display: none;
}

.tbr-search-trigger.tbr-search-mobile {
    display: flex;
    margin-left: auto;
    margin-right: 0.5rem;
}

/* Desktop: Show search icon before social links */
@media (min-width: 768px) {
    .tbr-search-trigger.tbr-search-mobile {
        display: none;
    }
    
    .tbr-search-trigger.tbr-search-desktop {
        display: flex;
    }
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 768px) {
    .tbr-search-container {
        padding: 1rem;
    }

    .tbr-search-input {
        font-size: 1.25rem;
        padding: 1rem 3rem 1rem 3.5rem;
    }

    .tbr-search-icon {
        left: 1rem;
    }

    .tbr-search-clear {
        right: 1rem;
    }

    .tbr-results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tbr-suggestions-list {
        gap: 0.75rem;
    }

    .tbr-suggestion-item {
        font-size: 0.875rem;
        padding: 0.625rem 1.25rem;
    }

    .tbr-result-thumbnail {
        width: 60px;
        height: 90px;
    }

    .tbr-results-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .tbr-search-input {
        font-size: 1rem;
    }

    .tbr-result-item {
        flex-direction: column;
    }

    .tbr-result-thumbnail {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .tbr-results-authors .tbr-result-item {
        flex-direction: row;
    }

    .tbr-results-authors .tbr-result-thumbnail {
        width: 60px;
        height: 60px;
        margin-right: 1rem;
        margin-bottom: 0;
    }
}
