/**
 * Estilos para el Sistema de Publicidad (ArteConLili)
 */

/* Wrapper del Banner */
.acl-banner-wrapper {
    position: relative;
    width: 100%;
    /* Transiciones suaves si se desea */
    transition: opacity 0.3s ease;
}

/* Contenido Global (Visible por defecto) */
.acl-content-global {
    display: none; /* Se oculta si no tiene la clase active, pero por PHP sale con active */
}

.acl-content-global.acl-active {
    display: block;
}

/* Contenido Geo-Específico (Inyectado via JS) */
.acl-content-geo {
    display: block;
    animation: aclFadeIn 0.5s ease-in-out;
}

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

/* Admin Styles (Tabs) - Ya incluidos inline en PHP, pero por si acaso */
.acl-tabs-wrapper {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 10px;
}

/* --------------------------
   Amazon Product Card Styles
   -------------------------- */
.acl-amz-card {
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
    padding: 0; /* Changed: Removed padding to allow full-width image */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    width: 100%; /* Fill container */
    max-width: 450px; /* Increased from 350px to give more "force" but keep sanity */
    margin: 10px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensure image respects border radius */
}

.acl-amz-link-wrapper {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.acl-amz-image {
    text-align: center;
    margin-bottom: 0; 
    /* Changed: Use aspect-ratio for a strong square image that scales */
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px; /* Internal padding so image doesn't touch edges if it fills */
    background: #fff;
    position: relative;
}

.acl-amz-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.acl-amz-image img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Optional: multiply blend mode if white bg issues? No, keep simple */
}

.acl-amz-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    line-height: 1.3;
    color: #111;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.acl-amz-desc {
    font-size: 13px;
    color: #555;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.acl-amz-rating {
    color: #ffa41c; /* Amazon orange star color */
    font-size: 14px;
    margin-bottom: 8px;
}

.acl-amz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-top: auto; /* Push to bottom */
}

.acl-amz-price {
    font-size: 18px;
    font-weight: 700;
    color: #B12704; /* Amazon price red */
}

.acl-amz-button {
    background: #FFD814; /* Amazon button yellow */
    border: 1px solid #FCD200;
    border-radius: 20px;
    padding: 6px 15px;
    font-size: 13px;
    color: #111;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(213, 217, 217, 0.5);
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}

.acl-amz-button:hover {
    background: #F7CA00;
}

/* --------------------------
   Amazon Grid Layout
   -------------------------- */
.acl-amz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.acl-amz-grid-item {
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
    padding: 0; /* Changed: Removed padding */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s;
    overflow: hidden; /* Ensure image respects border radius */
}

.acl-amz-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.acl-amz-grid-item .acl-amz-link-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* .acl-amz-content padding is handled by the shared class above */

.acl-amz-grid-item .acl-amz-footer {
    margin-top: auto; /* Push footer to bottom */
}

/* --------------------------
   Amazon List Layout
   -------------------------- */
.acl-amz-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.acl-amz-list-item {
    display: flex;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
    padding: 15px;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.acl-amz-image-col {
    flex: 0 0 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acl-amz-image-col img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.acl-amz-content-col {
    flex-grow: 1;
}

.acl-list-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #111;
    text-decoration: none;
    display: block;
}

.acl-amz-action-col {
    flex: 0 0 150px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-left: 1px solid #eee;
    padding-left: 20px;
}

/* Responsive List */
@media (max-width: 600px) {
    .acl-amz-list-item {
        flex-direction: column;
        text-align: center;
    }
    .acl-amz-action-col {
        border-left: none;
        padding-left: 0;
        width: 100%;
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: space-between;
    }
}

/* --------------------------
   Amazon Table Layout
   -------------------------- */
.acl-amz-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
}

.acl-amz-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensure scrolling on mobile */
}

.acl-amz-table th, 
.acl-amz-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.acl-amz-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 12px;
}

.acl-amz-table tr:last-child td {
    border-bottom: none;
}

/* Columns */
.acl-th-image, .acl-td-image { width: 100px; text-align: center; }
.acl-td-image img { max-height: 80px; max-width: 80px; object-fit: contain; }

.acl-table-title {
    font-weight: 600;
    color: #111;
    text-decoration: none;
    font-size: 16px;
    display: block;
    margin-bottom: 5px;
}

.acl-th-price, .acl-td-price { width: 120px; font-weight: 700; color: #B12704; font-size: 16px; }
.acl-th-btn, .acl-td-btn { width: 150px; text-align: right; }
.acl-td-btn .acl-amz-button { width: 100%; text-align: center; }

/* --------------------------
   Amazon Carousel Layout
   -------------------------- */
.acl-amz-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.acl-amz-carousel {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 15px; /* Space for scrollbar if visible */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.acl-amz-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.acl-amz-carousel-item {
    flex: 0 0 85%; /* Shows part of next slide to encourage scrolling */
    max-width: 320px;
    scroll-snap-align: center;
}

/* On desktop, maybe just show as grid or allow carousel? 
   If user wants carousel on desktop too: */
@media (min-width: 768px) {
    .acl-amz-carousel-item {
        flex: 0 0 300px; /* Fixed width on desktop */
    }
}

/* Carousel Navigation */
.acl-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 20px;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.acl-carousel-nav:hover {
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.acl-prev { left: -20px; }
.acl-next { right: -20px; }

@media (max-width: 768px) {
    .acl-carousel-nav { display: none; } /* Hide arrows on mobile, swipe is better */
}

/* Carousel Dots */
.acl-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.acl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: background 0.2s;
}

.acl-dot.active {
    background: #555;
}
