/* ===== MODERN SEARCH VARIABLES ===== */
.srch-search {
    --modern-search-primary: #ff6b6b; /* coral primary */
    --modern-search-primary-dark: #d04f4f; /* darker coral */
    --modern-search-secondary: #ffb86b; /* warm amber secondary */
    --modern-search-accent: #ff9f43; /* warm accent */
    --modern-search-bg: rgba(15, 23, 42, 0.98);
    --modern-search-surface: rgba(30, 41, 59, 0.8);
    --modern-search-border: 1px solid rgba(148, 163, 184, 0.2);
    --modern-search-glow: 0 18px 48px rgba(255, 107, 107, 0.14);
    --modern-search-radius: 16px;
    --modern-search-radius-sm: 12px;
    --modern-search-radius-xs: 8px;
}

/* ===== MODERN SEARCH LAYOUT ===== */
.srch-search {
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1006; /* keep search above breadcrumbs and nearby overlays */
}

.srch-search:focus-within {
    z-index: 1010; /* bring to front while interacting to avoid accidental focus on other UI */
}

.srch-form {
    width: 100%;
}

.srch-container {
    display: flex;
    gap: 12px;
    width: 100%;
}

/* ===== MODERN SEARCH INPUT ===== */
.srch-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--modern-search-surface);
    backdrop-filter: blur(20px);
    border: var(--modern-search-border);
    border-radius: var(--modern-search-radius);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.srch-input-wrapper:focus-within {
    border-color: var(--modern-search-primary);
    box-shadow: var(--modern-search-glow), 0 0 0 3px rgba(255, 159, 67, 0.08);
    transform: translateY(-2px);
}

.srch-icon {
    padding: 0 16px;
    font-size: 18px;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.srch-input-wrapper:focus-within .srch-icon {
    color: var(--modern-search-primary);
    transform: scale(1.1) rotate(10deg);
}

.srch-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f8fafc;
    font-size: 16px;
    padding: 16px 0;
    outline: none;
    width: 100%;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.srch-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* ===== CLEAR BUTTON ===== */
.srch-clear {
    display: none;
    background: rgba(148, 163, 184, 0.1);
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.3s ease;
    border-radius: var(--modern-search-radius-xs);
    margin: 0 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.srch-clear:hover {
    color: #f8fafc;
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.srch-clear.visible {
    display: flex;
}

.srch-clear-icon {
    font-size: 14px;
    font-weight: 600;
}

/* ===== SUBMIT BUTTON ===== */
.srch-submit {
    background: linear-gradient(135deg, var(--modern-search-primary), var(--modern-search-secondary));
    border: none;
    border-radius: var(--modern-search-radius);
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    font-weight: 600;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    box-shadow: 0 8px 32px rgba(255, 159, 67, 0.12);
}

.srch-submit:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(255, 159, 67, 0.16);
    background: linear-gradient(135deg, var(--modern-search-primary-dark), var(--modern-search-secondary));
}

.srch-submit-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.srch-submit:hover .srch-submit-icon {
    transform: translateX(3px);
}

/* ===== LIVE RESULTS ===== */
.srch-live-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--modern-search-bg);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 159, 67, 0.10);
    border-radius: var(--modern-search-radius);
    margin-top: 0;
    box-shadow: var(--modern-search-glow), 0 4px 32px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    max-height: 480px;
    overflow-y: auto;
    animation: srch-resultsSlideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
    scrollbar-color: var(--modern-search-primary) rgba(255, 255, 255, 0.1);
}

.srch-live-results::-webkit-scrollbar {
    width: 6px;
}

.srch-live-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.srch-live-results::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--modern-search-primary), var(--modern-search-secondary));
    border-radius: 10px;
}

@keyframes srch-resultsSlideDown {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.srch-live-results.active {
    display: block;
}

/* ===== RESULTS HEADER ===== */
.srch-search-results {
    padding: 0;
}
.srch-results-header {
    padding: 20px 24px 16px;
    background: linear-gradient(to right, rgba(255, 107, 107, 0.04), transparent);
    border-bottom: 1px solid rgba(255, 159, 67, 0.08);
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    z-index: 1;
}

.srch-results-count {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.srch-results-count svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    opacity: 0.95;
}

.srch-results-count:before {
    content: none;
}

/* ===== RESULT ITEMS ===== */
.srch-result-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.srch-result-link:last-child {
    border-bottom: none;
}

.srch-result-link:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255, 159, 67, 0) 0%, rgba(255, 159, 67, 0.04) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.srch-result-link:hover:before {
    opacity: 1;
}

.srch-result-link:hover {
    background: rgba(255, 159, 67, 0.02);
    transform: translateX(4px);
}

.srch-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    position: relative;
    z-index: 1;
}

/* ===== POSTER ===== */
.srch-result-poster {
    width: 60px;
    height: 84px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border-radius: var(--modern-search-radius-xs);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.srch-result-link:hover .srch-result-poster {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 8px 24px rgba(255, 159, 67, 0.12);
}

.srch-result-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.srch-result-link:hover .srch-result-poster img {
    transform: scale(1.1);
}

.srch-result-poster.placeholder {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.08), rgba(255, 184, 107, 0.06));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
}

/* ===== INFO ===== */
.srch-result-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.srch-result-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.srch-result-meta {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.srch-result-meta:before {
    content: none;
}

/* ===== ACTION ===== */
.srch-result-action {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.srch-result-link:hover .srch-result-action {
    opacity: 1;
    transform: translateX(0);
}

.srch-action-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--modern-search-primary), var(--modern-search-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(255, 159, 67, 0.12);
}

/* ===== LOADING STATE ===== */
.srch-loading {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    position: relative;
}

.srch-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 159, 67, 0.08);
    border-top: 3px solid var(--modern-search-primary);
    border-right: 3px solid var(--modern-search-secondary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: srch-spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

@keyframes srch-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.srch-loading-text {
    font-size: 15px;
    font-weight: 500;
    color: #cbd5e1;
}

/* ===== NO RESULTS ===== */
.srch-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.srch-no-results-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.7;
    animation: srch-float 3s ease-in-out infinite;
}

@keyframes srch-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.srch-no-results-title {
    font-size: 18px;
    color: #f8fafc;
    margin: 0 0 12px 0;
    font-weight: 700;
}

.srch-no-results-text {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: #cbd5e1;
    line-height: 1.5;
}

.srch-no-results-hint {
    font-size: 14px;
    opacity: 0.8;
    margin: 0;
    color: #94a3b8;
    font-style: italic;
}

/* ===== ERROR STATE ===== */
.srch-error {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.srch-error-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ef4444;
    animation: srch-shake 0.5s ease-in-out;
}

@keyframes srch-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.srch-error-title {
    font-size: 18px;
    color: #f8fafc;
    margin: 0 0 12px 0;
    font-weight: 700;
}

.srch-error-text {
    margin: 0 0 24px 0;
    font-size: 15px;
    color: #cbd5e1;
    line-height: 1.5;
}

.srch-retry-btn {
    background: linear-gradient(135deg, var(--modern-search-primary), var(--modern-search-secondary));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--modern-search-radius-xs);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(255, 159, 67, 0.12);
}

.srch-retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 159, 67, 0.16);
}

/* ===== SEE ALL ===== */
.srch-more {
    padding: 20px 24px;
    text-align: center;
    border-top: 1px solid rgba(255, 159, 67, 0.10);
    background: rgba(255, 159, 67, 0.02);
    position: sticky;
    bottom: 0;
    backdrop-filter: blur(10px);
}

.srch-more-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    color: var(--modern-search-primary);
    padding: 12px 24px;
    border-radius: var(--modern-search-radius-xs);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.srch-more-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(255,107,107,0.04), rgba(255,184,107,0.03));
    color: var(--modern-search-primary);
    padding: 12px 24px;
    border-radius: var(--modern-search-radius-xs);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 159, 67, 0.10);
}
.srch-more-link:hover {
    background: linear-gradient(135deg, rgba(255,107,107,0.08), rgba(255,184,107,0.06));
    border-color: rgba(255, 159, 67, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 159, 67, 0.08);
}

@media (max-width: 768px) {
    .srch-submit-icon {
        font-size: 16px;
    }
    
    .srch-live-results {
        max-height: 400px;
    }
    
    .srch-result-item {
        padding: 14px 16px;
        gap: 12px;
    }
    
    .srch-result-poster {
        width: 50px;
        height: 70px;
    }
    
    .srch-result-title {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .srch-input {
        font-size: 15px;
        padding: 14px 0;
    }
    
    .srch-icon {
        padding: 0 12px;
        font-size: 16px;
    }
    
    .srch-clear {
        width: 32px;
        height: 32px;
        margin: 0 6px;
    }
    
    .srch-result-item {
        padding: 12px;
        gap: 10px;
    }
    
    .srch-result-poster {
        width: 44px;
        height: 62px;
    }
    
    .srch-result-title {
        font-size: 14px;
    }
    
    .srch-result-meta {
        font-size: 12px;
    }
    
    .srch-action-icon {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
@media (prefers-color-scheme: dark) {
    .srch-input-wrapper {
        background: rgba(30, 41, 59, 0.9);
    }
    
    .srch-live-results {
        background: rgba(15, 23, 42, 0.95);
        border-color: rgba(255, 159, 67, 0.12);
    }
}

/* ===== ANIMATIONS ===== */
@keyframes srch-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.srch-result-item {
    animation: srch-fadeIn 0.3s ease-out forwards;
    opacity: 0;
}

.srch-result-item:nth-child(1) { animation-delay: 0.05s; }
.srch-result-item:nth-child(2) { animation-delay: 0.1s; }
.srch-result-item:nth-child(3) { animation-delay: 0.15s; }
.srch-result-item:nth-child(4) { animation-delay: 0.2s; }
.srch-result-item:nth-child(5) { animation-delay: 0.25s; }
.srch-result-item:nth-child(6) { animation-delay: 0.3s; }
.srch-result-item:nth-child(7) { animation-delay: 0.35s; }
.srch-result-item:nth-child(8) { animation-delay: 0.4s; }

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .srch-input-wrapper {
        border: 2px solid var(--modern-search-primary);
    }
    
    .srch-result-title {
        color: #ffffff;
    }
    
    .srch-result-meta {
        color: #cbd5e1;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .srch-input-wrapper,
    .srch-submit,
    .srch-result-link,
    .srch-result-poster,
    .srch-result-action,
    .srch-retry-btn,
    .srch-more-link {
        transition: none;
    }
    
    .srch-input-wrapper:focus-within,
    .srch-submit:hover,
    .srch-result-link:hover,
    .srch-result-poster:hover {
        transform: none;
    }
    
    .srch-no-results-icon {
        animation: none;
    }
    
    .srch-result-item {
        animation: none;
        opacity: 1;
    }
}