/**
 * Estilos CSS para SF Ads Manager Frontend
 * Basado en tu archivo assets/styles/widgets.scss
 */

/* === CONTENEDORES PRINCIPALES === */
.sf-ads-single,
.sf-ads-group {
    margin: 20px 0;
    text-align: center;
    overflow: hidden;
}

.sf-ads-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.sf-ads-group .sf-ads-single {
    flex: 1;
    min-width: 300px;
    max-width: 100%;
}

/* === TIPOS DE ANUNCIOS === */

/* Anuncios de imagen */
.sf-ads-image {
    position: relative;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sf-ads-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.sf-ads-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Anuncios de video */
.sf-ads-video {
    position: relative;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sf-ads-video-element {
    width: 100%;
    height: auto;
    display: block;
}

/* Contenedor de video externo */
.sf-ads-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sf-ads-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Enlaces de video */
.sf-ads-video-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.sf-ads-video-link:hover {
    transform: translateY(-2px);
}

.sf-ads-video-link a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sf-ads-video-link a:before {
    content: "▶";
    font-size: 14px;
}

/* Anuncios iframe */
.sf-ads-iframe-container {
    position: relative;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sf-ads-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Anuncios HTML */
.sf-ads-html {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === ENLACES === */
.sf-ads-link {
    display: inline-block;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.sf-ads-link:hover {
    opacity: 0.9;
}

/* === LAYOUTS DE GRUPO === */

/* Layouts de grupo */
.sf-ads-group {
    margin: 10px 0;
    clear: both;
}

/* Layout horizontal */
.sf-ads-horizontal-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.sf-ads-horizontal-item {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

/* Layout vertical */
.sf-ads-vertical-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sf-ads-vertical-item {
    width: 100%;
}

/* Layout mosaico */
.sf-ads-mosaic-container {
    display: grid;
    gap: 10px;
    margin: 10px 0;
}

.sf-ads-mosaic-2x2 {
    grid-template-columns: repeat(2, 1fr);
}

.sf-ads-mosaic-3x3 {
    grid-template-columns: repeat(3, 1fr);
}

.sf-ads-mosaic-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.sf-ads-mosaic-2x4 {
    grid-template-columns: repeat(2, 1fr);
}

.sf-ads-mosaic-4x2 {
    grid-template-columns: repeat(4, 1fr);
}

.sf-ads-mosaic-item {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsividad para mosaicos */
@media (max-width: 768px) {
    .sf-ads-mosaic-4x4,
    .sf-ads-mosaic-4x2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sf-ads-mosaic-3x3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sf-ads-horizontal-container {
        flex-direction: column;
    }
    
    .sf-ads-horizontal-item {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .sf-ads-mosaic-container {
        grid-template-columns: 1fr;
    }
}

/* === RESPONSIVE === */

/* Tablets */
@media (max-width: 768px) {
    .sf-ads-group.layout-horizontal {
        flex-direction: column;
    }
    
    .sf-ads-group.layout-mosaic-4x4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sf-ads-group.layout-mosaic-3x3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sf-ads-single,
    .sf-ads-group .sf-ads-single {
        min-width: auto;
        max-width: 100%;
    }
}

/* Móviles */
@media (max-width: 480px) {
    .sf-ads-group.layout-mosaic-2x2,
    .sf-ads-group.layout-mosaic-3x3,
    .sf-ads-group.layout-mosaic-4x4 {
        grid-template-columns: 1fr;
    }
    
    .sf-ads-single,
    .sf-ads-group {
        margin: 15px 0;
    }
    
    .sf-ads-group {
        gap: 10px;
    }
}

/* === ANIMACIONES === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sf-ads-single {
    animation: fadeIn 0.6s ease-out;
}

.sf-ads-group .sf-ads-single {
    animation-delay: calc(var(--item-index, 0) * 0.1s);
}

/* === UTILIDADES === */

/* Centrado */
.sf-ads-center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Flotante izquierda */
.sf-ads-float-left {
    float: left;
    margin-right: 20px;
    margin-bottom: 15px;
}

/* Flotante derecha */
.sf-ads-float-right {
    float: right;
    margin-left: 20px;
    margin-bottom: 15px;
}

/* Ancho completo */
.sf-ads-full-width {
    width: 100%;
    max-width: none;
}

/* === WIDGETS DE SIDEBAR === */
.widget .sf-ads-single {
    margin: 10px 0;
}

.widget .sf-ads-group {
    margin: 10px 0;
    gap: 10px;
}

.widget .sf-ads-image,
.widget .sf-ads-video,
.widget .sf-ads-video-container,
.widget .sf-ads-iframe-container,
.widget .sf-ads-html {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* === LOADING === */
.sf-ads-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.sf-ads-loading:before {
    content: "";
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* === TEMAS === */

/* Tema oscuro */
.sf-ads-dark .sf-ads-single,
.sf-ads-dark .sf-ads-group {
    background-color: #2d2d2d;
    color: #fff;
}

.sf-ads-dark .sf-ads-video-link {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Tema minimalista */
.sf-ads-minimal .sf-ads-image,
.sf-ads-minimal .sf-ads-video,
.sf-ads-minimal .sf-ads-video-container,
.sf-ads-minimal .sf-ads-iframe-container,
.sf-ads-minimal .sf-ads-html {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.sf-ads-minimal .sf-ads-image:hover,
.sf-ads-minimal .sf-ads-video:hover {
    transform: none;
    border-color: #cbd5e0;
}

/* === IMPRESIÓN === */
@media print {
    .sf-ads-single,
    .sf-ads-group {
        display: none !important;
    }
}

/* === ESTILOS POR POSICIÓN === */

/* Anuncios en contenido principal */
.sf-ads-single[data-position="content"] {
    width: 100%;
    max-width: 728px;
    margin: 30px auto;
}

.sf-ads-single[data-position="content"] .sf-ads-image {
    max-width: 100%;
}

/* Anuncios en sidebar */
.sf-ads-single[data-position="sidebar"] {
    width: 100%;
    max-width: 300px;
    margin: 15px 0;
}

.sf-ads-single[data-position="sidebar"] .sf-ads-image {
    max-width: 300px;
}

/* Anuncios en header */
.sf-ads-single[data-position="header"] {
    width: 100%;
    max-width: 970px;
    margin: 10px auto;
}

.sf-ads-single[data-position="header"] .sf-ads-image {
    max-width: 970px;
}

/* Anuncios en footer */
.sf-ads-single[data-position="footer"] {
    width: 100%;
    max-width: 970px;
    margin: 20px auto;
    text-align: center;
}

.sf-ads-single[data-position="footer"] .sf-ads-image {
    max-width: 970px;
}

/* Anuncios en widgets */
.sf-ads-single[data-position="widget"] {
    width: 100%;
    margin: 10px 0;
}

.sf-ads-single[data-position="widget"] .sf-ads-image {
    max-width: 100%;
}

/* Anuncios en popup/modal */
.sf-ads-single[data-position="popup"] {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
}

.sf-ads-single[data-position="popup"] .sf-ads-image {
    max-width: 500px;
}
