/**
 * Oyes Golf Magazine - Search Modal v5.0
 * Modal de búsqueda estilo "command palette"
 */

/* ========================================
   Modal Container
======================================== */

.ogm-search-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.ogm-search-modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

/* ========================================
   Overlay
======================================== */

.ogm-search-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

/* ========================================
   Content Box
======================================== */

.ogm-search-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Search Header
======================================== */

.ogm-search-header {
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ogm-search-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   Search Form
======================================== */

.ogm-search-form {
    margin: 0;
}

.ogm-search-inputwrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.ogm-search-inputwrap:focus-within {
    background: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

.ogm-search-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #9ca3af;
    transition: color 0.2s ease;
}

.ogm-search-inputwrap:focus-within .ogm-search-icon {
    color: #0f172a;
}

.ogm-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 1rem;
    color: #111827;
    outline: none;
    font-family: var(--font-system);
    font-weight: 400;
}

.ogm-search-input::placeholder {
    color: #9ca3af;
}

/* ========================================
   Close Button
======================================== */

.ogm-search-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 300;
    line-height: 1;
}

.ogm-search-close:hover {
    background: #e5e7eb;
    color: #111827;
}

/* ========================================
   Search Results
======================================== */

.ogm-search-results {
    overflow-y: auto;
    max-height: calc(80vh - 140px);
    flex: 1;
}

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

.ogm-search-results::-webkit-scrollbar-track {
    background: transparent;
}

.ogm-search-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.ogm-search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========================================
   Search Result Item
======================================== */

.ogm-search-result-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ogm-search-result-item:hover {
    background: #f9fafb;
}

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

.ogm-search-result-category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ogm-search-result-title {
    margin: 0 0 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

.ogm-search-result-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.ogm-search-result-title a:hover {
    color: #0f172a;
}

.ogm-search-result-excerpt {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.ogm-search-result-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ========================================
   Loading State
======================================== */

.ogm-search-loading {
    padding: 3rem 1.5rem;
    text-align: center;
}

.ogm-search-loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.ogm-search-loading p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ========================================
   No Results
======================================== */

.ogm-search-no-results {
    padding: 3rem 1.5rem;
    text-align: center;
}

.ogm-search-no-results svg {
    width: 48px;
    height: 48px;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.ogm-search-no-results p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.ogm-search-no-results strong {
    color: #374151;
    font-weight: 600;
}

/* ========================================
   Footer Hint
======================================== */

.ogm-search-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.ogm-search-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ogm-search-kbd {
    padding: 0.125rem 0.375rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: #6b7280;
    font-weight: 500;
}

/* ========================================
   Animations
======================================== */

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* ========================================
   Responsive
======================================== */

@media (max-width: 640px) {
    .ogm-search-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .ogm-search-results {
        max-height: calc(100vh - 140px);
    }
    
    .ogm-search-footer {
        display: none;
    }
}

/* ========================================
   Body Lock
======================================== */

body.ogm-modal-open {
    overflow: hidden;
}
