/* 
 * Spotlight Manager - Estilos Globales
 * Define el Grid Pro Híbrido (66/33) y el Panel de Administración.
 */

:root {
    --spotlight-primary: #4285F4;
    --spotlight-secondary: #34A853;
    --spotlight-accent: #FBBC05;
    --spotlight-danger: #EA4335;
    --spotlight-bg: #f8f9fa;
    --spotlight-card-bg: #ffffff;
    --spotlight-border: #e0e0e0;
    --spotlight-text: #333333;
}

/* --- FRONTEND: GRID PRO HÍBRIDO --- */
.spotlight-hybrid-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px; /* Valor por defecto, Elementor lo sobreescribirá */
    width: 100%;
    margin: 20px 0;
    /* Eliminamos min-height hardcodeado para que Elementor mande */
}

/* Zona Dinámica (Izquierda): 66% */
.spotlight-slider-area {
    width: 100%;
    height: 100%; /* Ocupa el 100% de la altura del grid padre */
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: #f0f0f0;
}

/* Zona Estática (Derecha): 33% */
.spotlight-sidebar-area {
    display: flex;
    flex-direction: column;
    gap: inherit; /* Hereda el gap del grid principal */
    height: 100%;
    min-height: 0; /* Evita desbordamientos en flex/grid */
}

.spotlight-sidebar-banner {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
    background: #f0f0f0;
    position: relative;
    min-height: 0;
}

.spotlight-sidebar-banner a,
.spotlight-slider-area a {
    display: block;
    width: 100%;
    height: 100%;
}

.spotlight-sidebar-banner img, 
.spotlight-slider-area img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    display: block;
    border-radius: inherit;
}

/* --- SWIPER CUSTOM NAVIGATION --- */
.spotlight-swiper,
.spotlight-swiper .swiper-wrapper,
.spotlight-swiper .swiper-slide {
    height: 100% !important;
    display: flex;
    align-items: stretch;
}

.spotlight-swiper .swiper-slide a.spotlight-ad-link {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    align-items: stretch;
    justify-content: stretch;
}

.spotlight-swiper .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    flex: 1;
}

.swiper-button-next, .swiper-button-prev {
    color: #fff !important;
    background: rgba(0,0,0,0.4);
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.swiper-button-next:hover, .swiper-button-prev:hover {
    background: rgba(0,0,0,0.7);
}

.swiper-button-next:after, .swiper-button-prev:after {
    font-size: 20px !important;
}

/* Paginación / Bullets */
.swiper-pagination-bullet {
    width: 12px !important;
    height: 12px !important;
    opacity: 0.8 !important;
    background: #fff !important; /* Color base */
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.swiper-pagination-bullet-active {
    transform: scale(1.3);
    opacity: 1 !important;
}

/* Adaptabilidad Móvil */
@media (max-width: 991px) {
    .spotlight-hybrid-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .spotlight-slider-area {
        height: 350px;
    }
    .spotlight-sidebar-area {
        height: auto;
        flex-direction: row;
    }
    .spotlight-sidebar-banner {
        height: 200px;
        flex: 1;
    }
}

/* --- FRONTEND: BLOG SPOTS --- */
.spotlight-ad-unit {
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: #f0f0f0;
}

.spotlight-ad-unit img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.spotlight-ad-blog-sidebar {
    max-width: 300px;
    height: 600px;
}

.spotlight-ad-blog-horizontal {
    max-width: 600px;
    height: 100px;
}

@media (max-width: 600px) {
    .spotlight-ad-blog-sidebar,
    .spotlight-ad-blog-horizontal {
        max-width: 100%;
        height: auto;
    }
}

/* --- BACKEND: PANEL DE ADMINISTRACIÓN --- */
.spotlight-admin-wrap {
    padding: 20px;
    background: transparent;
    border-radius: 8px;
    margin-top: 20px;
    color: var(--spotlight-text);
}

.spotlight-grid-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.spotlight-section-card {
    background: var(--spotlight-card-bg);
    border: 1px solid var(--spotlight-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.spotlight-section-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--spotlight-text);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--spotlight-primary);
    padding-bottom: 10px;
}

.spotlight-shortcode-row {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.shortcode-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.spotlight-shortcode-hint {
    background: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--spotlight-primary);
    border: 1px solid var(--spotlight-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-mono);
    font-weight: 600;
}

.spotlight-shortcode-hint:hover {
    background: var(--spotlight-primary);
    color: #fff;
}

/* Preview de Imagen */
.spotlight-preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #f0f0f0;
    border: 2px dashed #ccd0d4;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spotlight-preview-container.has-image {
    border-style: solid;
}

.spotlight-img-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.spotlight-no-image {
    color: #999;
    font-style: italic;
}

.spotlight-delete-ad-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #d63638;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.spotlight-preview-container:hover .spotlight-delete-ad-btn {
    opacity: 1;
}

.spotlight-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.spotlight-preview-container:hover .spotlight-upload-overlay {
    opacity: 1;
}

.spotlight-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Campos del Formulario */
.field-group {
    margin-bottom: 15px;
}

.field-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.field-group input, 
.field-group textarea, 
.field-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--spotlight-border);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Barra de Estadísticas */
.spotlight-stats-bar {
    display: flex;
    justify-content: space-around;
    background: #f1f1f1;
    padding: 10px;
    border-radius: 6px;
    margin-top: auto;
    font-size: 0.85rem;
}

.stat-item .dashicons {
    font-size: 16px;
    margin-right: 3px;
    color: var(--spotlight-primary);
    vertical-align: middle;
}

.spotlight-admin-actions {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
    text-align: center;
}

/* Botón Guardar */
.spotlight-save-btn {
    background: var(--spotlight-primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s ease;
    font-size: 1rem;
}

.spotlight-save-btn:hover {
    background: #3367d6;
}

/* --- HISTORIAL DE PUBLICACIONES --- */
.spotlight-history-section {
    margin-top: 40px;
}

.spotlight-history-section h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.spotlight-history-section p {
    color: #666;
    margin-bottom: 20px;
}

#spotlight-history-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
    background: transparent;
    border: none;
    box-shadow: none;
}

#spotlight-history-table thead th {
    border: none;
    background: transparent;
    padding: 10px 15px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

#spotlight-history-table tbody tr {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

#spotlight-history-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#spotlight-history-table tbody td {
    padding: 15px;
    border: none;
    vertical-align: middle;
    background: #fff;
}

/* Rounded corners for the first and last cell of each row */
#spotlight-history-table tbody tr td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

#spotlight-history-table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

#spotlight-history-table tbody tr td img {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.delete-history-btn {
    color: var(--spotlight-danger) !important;
    font-weight: 500 !important;
}

.delete-history-btn:hover {
    color: #b32d2e !important;
}

/* --- MODAL DE DETALLES --- */
.spotlight-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.spotlight-modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    padding: 40px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: spotlight-modal-in 0.3s ease-out;
}

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

.spotlight-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.spotlight-close:hover {
    color: #000;
}

.spotlight-details-body {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
}

/* Estado de carga para imágenes */
.spotlight-slider-area img,
.spotlight-sidebar-banner img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.spotlight-slider-area img.loaded,
.spotlight-sidebar-banner img.loaded {
    opacity: 1;
}

.spotlight-slider-area::before,
.spotlight-sidebar-banner::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--spotlight-primary);
    border-radius: 50%;
    animation: spotlight-spin 1s infinite linear;
    z-index: 1;
}

.spotlight-slider-area.loaded::before,
.spotlight-sidebar-banner.loaded::before {
    display: none;
}
