/**
 * OV Live Search - Estilos Principales
 * @package OV_Live_Search
 */

:root {
    --ov-primary-color: #2563eb;
    --ov-primary-hover: #1d4ed8;
    --ov-text-color: #1f2937;
    --ov-text-light: #6b7280;
    --ov-border-color: #e5e7eb;
    --ov-bg-light: #f9fafb;
    --ov-success-color: #10b981;
    --ov-error-color: #ef4444;
    --ov-highlight-bg: #fef3c7;
    --ov-highlight-text: #92400e;
    --ov-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ov-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --ov-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --ov-radius: 8px;
    --ov-transition: all 0.3s ease;
}

.ov-live-search-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: inherit, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ov-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ov-search-input-wrapper {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.ov-search-input {
    width: 100%;
    padding: 14px 48px 14px 48px !important;
    font-size: 16px !important;
    border: 2px solid var(--ov-border-color) !important;
    border-radius: var(--ov-radius) !important;
    transition: var(--ov-transition);
    background: white !important;
    color: var(--ov-text-color) !important;
    box-sizing: border-box !important;
}

.ov-search-input:focus {
    outline: none !important;
    border-color: color-mix(in srgb, var(--ov-border-color), black 10%) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.ov-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ov-text-light);
    pointer-events: none;
}

.ov-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--ov-bg-light);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--ov-transition);
    color: var(--ov-text-light);
}

.ov-search-clear:hover {
    background: var(--ov-border-color);
    color: var(--ov-text-color);
}

.ov-search-filters {
    position: relative;
}

.ov-filter-toggle {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--ov-border-color);
    border-radius: var(--ov-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--ov-transition);
    color: var(--ov-text-color);
    height: 100%;
}

.ov-filter-toggle:hover {
    border-color: var(--ov-primary-color);
    color: var(--ov-primary-color);
}

.ov-filters-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--ov-border-color);
    border-radius: var(--ov-radius);
    box-shadow: var(--ov-shadow-lg);
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
}

/* Mejorar scroll del dropdown */
.ov-filters-dropdown::-webkit-scrollbar {
    width: 8px;
}

.ov-filters-dropdown::-webkit-scrollbar-track {
    background: var(--ov-bg-light);
    border-radius: 4px;
}

.ov-filters-dropdown::-webkit-scrollbar-thumb {
    background: var(--ov-border-color);
    border-radius: 4px;
}

.ov-filters-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--ov-text-light);
}

.ov-filter-section {
    margin-bottom: 20px;
}

.ov-filter-section:last-child {
    margin-bottom: 0;
}

.ov-filter-section > label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--ov-text-color);
}

.ov-filter-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ov-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--ov-transition);
}

.ov-filter-option:hover {
    background: var(--ov-bg-light);
}

.ov-filter-option input[type="checkbox"],
.ov-filter-option input[type="radio"] {
    cursor: pointer;
}

.ov-filter-option span {
    font-size: 14px;
    color: var(--ov-text-color);
}

.ov-search-status {
    padding: 12px 16px;
    border-radius: var(--ov-radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.ov-status-info {
    background: #dbeafe;
    color: #1e40af;
}

.ov-status-success {
    background: #d1fae5;
    color: #065f46;
}

.ov-status-error {
    background: #fee2e2;
    color: #991b1b;
}

.ov-status-empty {
    background: var(--ov-bg-light);
    color: var(--ov-text-light);
    text-align: center;
    padding: 40px 20px;
}

.ov-search-loading {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.ov-skeleton-card {
    background: white;
    border-radius: var(--ov-radius);
    overflow: hidden;
    box-shadow: var(--ov-shadow-sm);
}

.ov-skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: ovSkeletonLoading 1.5s infinite;
}

.ov-skeleton-content {
    padding: 20px;
}

.ov-skeleton-title {
    width: 80%;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: ovSkeletonLoading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.ov-skeleton-text {
    width: 100%;
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: ovSkeletonLoading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

@keyframes ovSkeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.ov-results-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.ov-results-grid.ov-columns-2 {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

.ov-results-grid.ov-columns-3 {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.ov-results-grid.ov-columns-4 {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ov-result-card {
    background: white;
    border-radius: var(--ov-radius);
    overflow: hidden;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.15);
    transition: var(--ov-transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ov-result-card:hover {
    box-shadow: var(--ov-shadow-md);
    transform: translateY(-4px);
}

.ov-result-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--ov-bg-light);
}

.ov-result-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.ov-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--ov-transition);
    opacity: 0;
}

.ov-result-thumbnail img.ov-loaded {
    opacity: 1;
}

.ov-result-card:hover .ov-result-thumbnail img {
    transform: scale(1.05);
}

.ov-result-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ov-result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--ov-text-light);
}

.ov-result-type {
    border: 1px solid var(--ov-primary-color);
    color: var(--ov-primary-color);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}

.ov-result-date {
    font-weight: 500;
}

.ov-result-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.ov-result-title a {
    color: var(--ov-text-color);
    text-decoration: none;
    transition: var(--ov-transition);
}

.ov-result-title a:hover {
    color: var(--ov-primary-color);
}

.ov-result-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ov-text-light);
    margin: 0 0 12px 0;
    flex: 1;
}

.ov-result-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    margin-bottom: 12px;
}

.ov-result-category {
    font-size: 11px;
    color: var(--ov-text-light);
    background: transparent;
    padding: 4px 8px;
    border: 1px solid var(--ov-border-color);
    border-radius: 4px;
    text-decoration: none;
    transition: var(--ov-transition);
    font-weight: 500;
}

.ov-result-category:hover {
    border-color: var(--ov-primary-color);
    color: var(--ov-primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.ov-result-actions {
    margin-top: auto;
    padding-top: 16px;
}

.ov-result-button {
    display: inline-block;
    padding: 10px 20px;
    background: var(--ov-primary-color);
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--ov-transition);
    text-align: center;
    box-shadow: var(--ov-shadow-sm);
}

.ov-result-button:hover {
    background: var(--ov-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--ov-shadow-md);
}

.ov-highlight {
    background: var(--ov-highlight-bg);
    color: var(--ov-highlight-text);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.ov-load-more-wrapper {
    text-align: center;
    margin-top: 32px;
}

.ov-load-more {
    padding: 14px 32px;
    background: var(--ov-primary-color);
    color: white;
    border: none;
    border-radius: var(--ov-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ov-transition);
}

.ov-load-more:hover:not(:disabled) {
    background: var(--ov-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--ov-shadow-md);
}

.ov-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ov-layout-compact .ov-result-card {
    flex-direction: row;
}

.ov-layout-compact .ov-result-thumbnail {
    width: 200px;
    height: auto;
    min-height: 150px;
}

.ov-layout-compact .ov-result-content {
    flex: 1;
}

.ov-layout-minimal .ov-result-card {
    box-shadow: none;
    border: 1px solid var(--ov-border-color);
}

.ov-layout-minimal .ov-result-thumbnail {
    height: 150px;
}

@media (max-width: 768px) {
    .ov-search-bar {
        flex-direction: column;
    }
    
    .ov-search-input-wrapper {
        min-width: 100%;
    }
    
    .ov-results-grid {
        grid-template-columns: 1fr !important;
    }
    
    .ov-layout-compact .ov-result-card {
        flex-direction: column;
    }
    
    .ov-layout-compact .ov-result-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .ov-filters-dropdown {
        left: 0;
        right: 0;
        min-width: auto;
    }

    .ov-filter-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ov-live-search-wrapper {
        padding: 12px;
    }
    
    .ov-search-input {
        padding: 12px 40px 12px 40px !important;
        font-size: 14px !important;
    }
    
    .ov-result-title {
        font-size: 16px;
    }

    .ov-search-icon {
        transform: translateY(-40%);
    }

    .ov-search-icon svg {
        width: 16px; 
        height: 16px;
    }
}

/* ========================================
   Modal/Popup Styles
======================================== */
.ov-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.ov-search-modal.ov-modal-open {
    display: flex;
}

.ov-search-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: ovFadeIn 0.2s ease;
}

.ov-search-modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 1000000;
    animation: ovSlideDown 0.3s ease;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.ov-search-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: white;
    border: 2px solid var(--ov-border-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--ov-transition);
    color: var(--ov-text-light);
    z-index: 1000001;
    box-shadow: var(--ov-shadow-md);
}

.ov-search-modal-close:hover {
    background: var(--ov-error-color);
    border-color: var(--ov-error-color);
    color: white;
    transform: rotate(90deg);
}

.ov-search-modal-content {
    flex: 1;
    overflow: visible;
    padding: 20px;
}

.ov-modal-search {
    max-width: 100%;
    padding: 0;
}

.ov-modal-search .ov-search-bar {
    padding-right: 60px;
}

.ov-modal-search .ov-results-grid {
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

/* Scrollbar personalizado */
.ov-modal-search .ov-results-grid::-webkit-scrollbar {
    width: 6px;
}

.ov-modal-search .ov-results-grid::-webkit-scrollbar-track {
    background: var(--ov-bg-light);
    border-radius: 4px;
}

.ov-modal-search .ov-results-grid::-webkit-scrollbar-thumb {
    background: var(--ov-border-color);
    border-radius: 4px;
}

.ov-modal-search .ov-results-grid::-webkit-scrollbar-thumb:hover {
    background: var(--ov-text-light);
}

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

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

/* Modal responsive */
@media (max-width: 768px) {
    .ov-search-modal {
        padding-top: 2vh;
    }
    
    .ov-search-modal-container {
        width: 98%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .ov-search-modal-content {
        padding: 10px;
    }
    
    .ov-modal-search .ov-search-bar {
        padding-right: 50px;
        flex-direction: column;
    }
    
    .ov-modal-search .ov-search-input-wrapper {
        min-width: 100%;
    }
    
    .ov-search-modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
}

@media (min-width: 769px) {
    .ov-search-modal-container {
        margin: 0 20px;
    }
}
