/* sidebar-styles.css */

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Container principal */
.container {
    display: flex;
    flex-direction: row; /* Asegura que los elementos se alineen horizontalmente */
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
}

/* Contenido principal (placeholder) */
.main-content {
    flex: 1; /* Toma el espacio disponible */
    order: 1; /* Orden en el flujo flex */
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Estilos del sidebar */
.sidebar {
    width: 100%;
    order: 2; /* Para asegurar que siempre aparezca a la izquierda */
    flex-shrink: 0; /* Evita que el sidebar se encoja */
    max-width: 400px;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Estilos base de los widgets */
.widget {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.12);
}

.widget h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    padding: 0 20px;
    padding-top: 20px;
}

/* Widget Top Band Styling */
.gallery-widget, .social-widget {
    position: relative;
    padding-top: 50px !important; /* Space for the band */
}

.gallery-widget::before, .social-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    z-index: 1;
}

.gallery-widget h3, .social-widget h3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    margin: 0;
    color: white;
    text-align: center;
    z-index: 2;
}

/* Widget de Atención Ciudadana */
.information-widget .widget-content {
    position: relative;
}

.information-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.information-info {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.information-info h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding: 0;
}

.highlight {
    color: #ffd700;
    font-weight: 700;
}

.icons-sidebar {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

.icons-sidebar i {
    margin-top: 3px;
    margin-right: 10px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.icons-sidebar span {
    flex: 1;
}

/* Widget de Galería */
.gallery-widget {
    padding: 20px;
}

.gallery-slider {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.slider-container {
    position: relative;
    height: 500px;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    pointer-events: none;
}

.prev-btn, .next-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s ease;
    pointer-events: all;
}

.prev-btn:hover, .next-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: #667eea;
}

/* Widget de Estadísticas */
.image-widget {
    padding: 15px;
}

.image-widget-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Widgets de Redes Sociales */
.social-widget {
    padding: 20px;
}

.video-widget.social-widget {
    padding-bottom: 0;
}

.facebook-embed {
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.twitter-embed {
    border-radius: 8px;
    overflow: hidden
}

.facebook-embed iframe {
    width: 100% !important;
    height: 500px !important; /* Set height to 500px */
    border-radius: 8px;
    max-width: 100%;   
}

/* Video Embed Widget Styles */
.video-embed.horizontal {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-embed.horizontal iframe {
    width: 100%;
    max-width: 560px;
    height: 314px;
    border-radius: 10px;
}

.video-embed.vertical {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.video-embed.vertical iframe,
.video-embed.vertical blockquote {
    width: 320px !important;
    max-width: 95vw;
    height: 570px !important;
    margin: 0 auto;
    border-radius: 10px;
    position: static !important; /* Anular posicionamiento absoluto */
}

.widget .video-embed.vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: auto;
    padding-bottom: 0;
    width: 100%;
}

/* Anular el contenedor responsivo para videos verticales */
.video-embed.vertical .embed-responsive {
    padding-top: 0 !important;
    position: static !important;
    height: auto !important;
    display: flex;
    justify-content: center;
    margin-bottom: 0;
}

.video-embed.vertical iframe,
.video-embed.vertical blockquote {
    width: 100% !important;
    max-width: 400px !important;
    height: 640px !important;
    position: relative !important;
    margin: 0 auto;
    display: block;
}

@media (max-width: 600px) {
    .video-embed.vertical iframe,
    .video-embed.vertical blockquote {
        width: 85vw !important;
        height: 134vw !important; /* Mantenemos proporción 9:16 para videos verticales */
        max-height: 600px;
    }
}

/* Contenedor responsivo base */
.embed-responsive {
    position: relative;
    width: 100%;
    max-width: 800px; /* Máximo ancho del embed */
    margin: 0 auto;
    overflow: hidden;
}

/* Relación de aspecto 16:9 (para YouTube y Facebook) - solo para horizontal */
.video-embed.horizontal .embed-responsive,
.social-widget:not(.video-widget) .embed-responsive {
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.embed-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* Media Queries para Responsividad */

/* Pantallas grandes (mayor a 992px) */
@media (min-width: 992px) {
    .container {
        flex-direction: row;
    }
    
    .sidebar {
        width: 40%;
        flex-shrink: 0;
    }
    
    .main-content {
        width: 60%;
    }
}

/* Pantallas medianas y pequeñas (menor a 992px) */
@media (max-width: 991px) {
    .container {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
    }
    
    .sidebar {
        width: 100%;
        max-width: none;
        order: 2;
    }
    
    .main-content {
        width: 100%;
        order: 1;
        padding: 20px;
    }
    
    .sidebar-inner {
        gap: 20px;
    }
    
    .widget h3 {
        font-size: 1.1rem;
    }
    
    .slider-container {
        height: 500px;
    }

    .facebook-embed {
        border-radius: 8px;
        overflow: hidden;
        display: flex;
        justify-content: center;
    }

    .facebook-embed iframe {
        width: 100% !important;
        height: 500px !important; /* Set height to 500px */
        border-radius: 8px;
        max-width: 100%;   
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .sidebar-inner {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    /* Los demás widgets ocuparán el ancho completo */
    .information-widget,
    .image-widget,
    .gallery-widget, 
    .social-widget:has(.facebook-embed) {
        width: 100%;
    }

    .slider-container {
        height: 500px;
    }

    .facebook-embed {
        border-radius: 8px;
        overflow: hidden;
        display: flex;
        justify-content: center;
    }

    .facebook-embed iframe {
        width: 100% !important;
        height: 500px !important; /* Set height to 500px */
        border-radius: 8px;
        max-width: 100%;   
    }
}

/* Pantallas móviles pequeñas */
@media (max-width: 576px) {
    .container {
        padding: 10px;
        gap: 15px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .widget {
        border-radius: 8px;
    }
    
    .information-info {
        padding: 15px;
    }
    
    .gallery-widget {
        padding: 15px;
    }
    
    .social-widget {
        padding: 15px;
    }
    
    .slider-container {
        height: 500px;
    }
    
    .prev-btn, .next-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .facebook-embed iframe {
        height: 500px !important;
    }

    .gallery-widget, .social-widget {
        padding-top: 45px !important;
    }
    
    .gallery-widget::before, .social-widget::before {
        height: 35px;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }
}

/* Animaciones adicionales */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget {
    animation: fadeInUp 0.6s ease-out;
}

/* Mejoras de accesibilidad */
.prev-btn:focus, .next-btn:focus, .dot:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Efectos hover adicionales */
.widget:hover .information-info {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.dot:hover {
    background: #667eea;
    transform: scale(1.1);
}

.widget-wrapper {
    position: relative;
    margin-bottom: 30px;
}