/* ========================================
   Atlas template enhancements - hero logic
   ======================================== */

/* Badge variants */
.badge-featured {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
}

.badge-hot {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.badge-new {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.badge-sale {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.badge-default {
    background: rgba(14, 139, 139, 0.12);
    color: var(--primary);
}

/* Hero badge (absolute positioning) */
.spotlight-card .featured-tag {
    position: absolute;
    top: 42px;
    left: 42px;
    z-index: 20;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Discount badge */
.discount-tag {
    position: absolute;
    top: 42px;
    right: 42px;
    background: #ef4444;
    color: #fff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    z-index: 20;
}

/* Hero image wrapper */
.hero-image-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

.hero-image-wrapper img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
}

/* Hero switch button */
.switch-hero-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(14, 139, 139, 0.2);
    border-radius: 999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.switch-hero-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(14, 139, 139, 0.3);
}

.switch-hero-btn:active {
    transform: translateY(0);
}

.switch-hero-btn svg {
    width: 16px;
    height: 16px;
}

.switch-hero-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.switch-hero-btn.loading svg {
    animation: spin 1s linear infinite;
}

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

/* Gallery thumbnails */
.hero-gallery {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.gallery-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.gallery-thumb:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.gallery-thumb.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(14, 139, 139, 0.2);
}

/* Product stats */
.product-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    margin-top: 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(14, 139, 139, 0.08);
    border-radius: 999px;
    color: var(--muted);
}

.stat-item svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
}

.stat-item.stock-low {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    font-weight: 600;
}

.stat-item.stock-out {
    background: rgba(107, 114, 128, 0.1);
    color: var(--muted);
}

.stat-item.stock-normal {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* Price group */
.price-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.original-price {
    text-decoration: line-through;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}

.original-price-small {
    text-decoration: line-through;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

/* Small card enhancements */
.product-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.product-image-wrapper img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s ease;
    height: 520px;
    max-height: 520px;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
}

.product-card .product-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-card .badge {
    display: inline-block;
    align-self: flex-start;
}

.product-card h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 48px;
}

/* Short intro (top) */
.product-card .product-intro {
    margin: 4px 0 0 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Detail content (bottom) */
.product-card .product-details {
    background: rgba(14, 139, 139, 0.04);
    border-left: 3px solid var(--primary);
    padding: 12px 14px;
    border-radius: 8px;
    flex-grow: 1;
}

.product-card .product-details p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.product-card .product-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    min-height: 24px;
}

.product-sales {
    font-size: 12px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-sales svg {
    flex-shrink: 0;
}

.stock-warning {
    font-size: 11px;
    color: #dc2626;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stock-warning svg {
    flex-shrink: 0;
}

.product-card .card-actions {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(31, 42, 55, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.product-card .card-actions .price-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-card .card-actions .btn-add-cart {
    padding: 8px 12px;
    min-width: auto;
}

.product-card .card-actions .btn-add-cart svg {
    margin: 0;
}

/* Loading animation */
.hero-loading {
    position: relative;
    overflow: hidden;
}

.hero-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Smooth transition */
.fade-transition {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-transition.hiding {
    opacity: 0;
    transform: scale(0.98);
}

/* Ad strip between categories */
.ad-strip-section {
    padding: 20px 0;
}

.ad-strip {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.ad-strip:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.12);
}

.ad-strip img {
    width: 100%;
    height: auto;
    display: block;
}

.ad-strip a {
    display: block;
}

/* Secondary product scroll container */
.product-grid-wrapper {
    position: relative;
}

/* Scroll buttons */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(14, 139, 139, 0.2);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    transition: all 0.3s ease;
}

.scroll-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(14, 139, 139, 0.3);
}

.scroll-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.scroll-btn-left {
    left: -24px;
}

.scroll-btn-right {
    right: -24px;
}

.scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    .switch-hero-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .hero-gallery {
        gap: 6px;
    }
    
    .gallery-thumb {
        width: 60px;
        height: 60px;
    }
    
    .product-stats {
        font-size: 11px;
    }
    
    .discount-tag {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .product-card {
        min-height: auto;
        gap: 8px;
    }
    
    .product-card h5 {
        font-size: 14px;
        line-height: 1.4;
        min-height: 39px;
    }
    
    .product-card .product-intro {
        font-size: 12px;
        line-height: 1.5;
        -webkit-line-clamp: 1;
    }
    
    .product-card .product-details {
        padding: 8px 10px;
    }
    
    .product-card .product-details p {
        font-size: 11px;
        line-height: 1.6;
        -webkit-line-clamp: 3;
    }
    
    .product-sales {
        font-size: 11px;
    }
    
    .stock-warning {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .spotlight-meta h4 {
        font-size: 20px;
    }
    
    .spotlight-meta p {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    /* Mobile scroll optimization */
    .scroll-btn {
        display: none;
    }
    
    .product-grid {
        gap: 12px;
        -webkit-overflow-scrolling: touch;
    }
    
    .product-grid .product-card {
        flex: 0 0 85%;
        min-width: 85%;
    }
    
    /* Mobile ad banner */
    .ad-banner {
        margin: 32px 0;
        padding: 24px 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .ad-content h4 {
        font-size: 18px;
    }
    
    .ad-content p {
        font-size: 13px;
    }
    
    .ad-action .btn {
        width: 100%;
        justify-content: center;
    }
}
