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

.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 100000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.search-container {
    width: 100%;
    max-width: 700px;
    margin: 80px 20px;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    animation: slideDown 0.3s ease;
}

.search-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-header-icon {
    font-size: 1.3rem;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    background: transparent;
    padding: 8px 0;
}

.search-input::placeholder {
    color: #aaa;
}

.close-search-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.close-search-btn:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
}

.search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #8b5e3c;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #6b3e2c;
}

.search-footer {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.7rem;
    color: #888;
    display: flex;
    justify-content: space-between;
}

.search-result-item {
    padding: 14px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover {
    background: rgba(139,94,60,0.08);
    padding-right: 28px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    margin-bottom: 6px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    color: #1a1a1a;
    font-size: 0.95rem;
}

.search-result-excerpt {
    font-size: 0.75rem;
    color: #888;
    line-height: 1.5;
}

.search-highlight {
    background: rgba(255,235,59,0.5);
    padding: 0 2px;
    border-radius: 4px;
    font-weight: 500;
}

.search-empty,
.search-start {
    padding: 50px 40px;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

.search-empty span {
    color: #8b5e3c;
    font-weight: 500;
}

.search-button {
    background: #f0f0f0;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    font-size: 1.3rem;
    color: #1a1a1a;
}

.mag-header.scrolled .search-button {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.search-button:hover {
    transform: scale(1.08);
    background: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.search-button:active {
    transform: scale(0.98);
}

body.dark-theme .search-button {
    background: #1e2a3a;
    color: #ffd700;
}

body.dark-theme .search-button:hover {
    background: #2a3a5c;
    color: #ffd700;
}

body.dark-theme .search-container {
    background: #0f1a2e;
}

body.dark-theme .search-header {
    border-bottom-color: #1e2a3a;
}

body.dark-theme .search-input {
    color: #e0e0e0;
}

body.dark-theme .search-input::placeholder {
    color: #5a6a7a;
}

body.dark-theme .close-search-btn {
    color: #b0c4de;
}

body.dark-theme .close-search-btn:hover {
    background: rgba(255,215,0,0.15);
    color: #ffd700;
}

body.dark-theme .search-footer {
    border-top-color: #1e2a3a;
    color: #6a7a8a;
}

body.dark-theme .search-results::-webkit-scrollbar-track {
    background: #1a2a3a;
}

body.dark-theme .search-results::-webkit-scrollbar-thumb {
    background: #ffd700;
}

body.dark-theme .search-results::-webkit-scrollbar-thumb:hover {
    background: #e6c200;
}

body.dark-theme .search-result-item {
    border-bottom-color: #1e2a3a;
}

body.dark-theme .search-result-item:hover {
    background: rgba(255,215,0,0.08);
}

body.dark-theme .search-result-title {
    color: #e0e0e0;
}

body.dark-theme .search-result-excerpt {
    color: #8aaec0;
}

body.dark-theme .search-highlight {
    background: rgba(255,215,0,0.35);
    color: #ffd700;
}

body.dark-theme .search-empty,
body.dark-theme .search-start {
    color: #7a8a9a;
}

body.dark-theme .search-empty span {
    color: #ffd700;
}

@media (max-width: 768px) {
    .search-button {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .search-container {
        margin: 60px 15px;
        border-radius: 20px;
    }
    
    .search-header {
        padding: 15px 18px;
    }
    
    .search-header-icon {
        font-size: 1.1rem;
    }
    
    .search-input {
        font-size: 0.95rem;
    }
    
    .close-search-btn {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .search-result-item {
        padding: 12px 18px;
    }
    
    .search-result-title {
        font-size: 0.85rem;
    }
    
    .search-result-excerpt {
        font-size: 0.7rem;
    }
    
    .search-empty,
    .search-start {
        padding: 40px 25px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .search-button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .search-container {
        margin: 50px 12px;
        border-radius: 18px;
    }
    
    .search-header {
        padding: 12px 15px;
        gap: 8px;
    }
    
    .search-header-icon {
        font-size: 1rem;
    }
    
    .search-input {
        font-size: 0.85rem;
    }
    
    .close-search-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .search-result-item {
        padding: 10px 15px;
    }
    
    .search-result-title {
        font-size: 0.8rem;
    }
    
    .search-result-excerpt {
        font-size: 0.65rem;
    }
    
    .search-empty,
    .search-start {
        padding: 30px 20px;
        font-size: 0.8rem;
    }
    
    .search-footer {
        padding: 10px 15px;
        font-size: 0.6rem;
    }
}

@media (max-width: 768px) {
    .search-button {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.1rem !important;
    }
}

@media (max-width: 480px) {
    .search-button {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }
}