/**
 * Dynamic Theme Styles - Auto-switch berdasarkan periode
 * Theme colors are set via inline CSS variables from ThemeManager
 */

/* Default Theme Variables - Will be overridden by inline styles from ThemeManager */
:root {
    --theme-primary: #DF63A1;
    --theme-secondary: #871A66;
    --theme-accent: #FF8DC7;
    --theme-gradient-start: #DF63A1;
    --theme-gradient-end: #871A66;
    
    /* Theme decoration colors - gold/orange for elegant contrast */
    --theme-decor-primary: #FFD700;
    --theme-decor-secondary: #FFA500;
}

/* Apply theme colors to components using CSS variables */
.welcome-card {
    background: linear-gradient(135deg, var(--theme-gradient-start) 0%, var(--theme-gradient-end) 100%) !important;
}

#scanBarcodeBtn i {
    color: var(--theme-primary) !important;
}

#scanBarcodeBtn:hover {
    box-shadow: 0 6px 20px rgba(var(--theme-primary-rgb), 0.25) !important;
}

.quick-action:hover {
    background: linear-gradient(135deg, var(--theme-gradient-start), var(--theme-gradient-end));
}

.quick-action:hover i {
    color: #FFD700;
}

/* Text (title and description) should be gold on hover for better contrast */
.quick-action:hover .quick-action-title,
.quick-action:hover .quick-action-desc {
    color: #FFD700;
}

/* Ramadhan Theme Specific */
.theme-ramadhan {
    --theme-decor-primary: #FFD700;
    --theme-decor-secondary: #FFA500;
}

.theme-ramadhan .welcome-card::before {
    content: '☪';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 72px;
    z-index: 5;
    opacity: 0.12;
    color: var(--theme-decor-primary);
    animation: float 6s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}

.theme-ramadhan .welcome-card::after {
    content: '🌙';
    position: absolute;
    bottom: 30px;
    left: 20px;
    font-size: 48px;
    z-index: 5;
    opacity: 0.15;
    animation: float 8s ease-in-out infinite reverse;
}

/* Ramadhan Card Corner Decorations */
.theme-ramadhan .card,
.theme-ramadhan .product-card {
    position: relative;
    overflow: visible !important;
}

.theme-ramadhan .card::before,
.theme-ramadhan .product-card::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--theme-decor-primary) 0%, var(--theme-decor-secondary) 100%);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    z-index: 10;
    opacity: 0.9;
    border-radius: 0 12px 0 0;
}

.theme-ramadhan .card::after,
.theme-ramadhan .product-card::after {
    content: '✦';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
    color: var(--theme-decor-secondary);
    z-index: 11;
    animation: sparkle 3s ease-in-out infinite;
}

/* Ramadhan Quick Actions */
.theme-ramadhan .quick-action {
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), 
                      linear-gradient(135deg, var(--theme-decor-primary), var(--theme-decor-secondary));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    position: relative;
}

.theme-ramadhan .quick-action::before {
    content: '◆';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 8px;
    color: var(--theme-decor-primary);
    opacity: 0.6;
}

/* Ramadhan Category Items */
.theme-ramadhan .category-item {
    position: relative;
    border: 2px solid transparent !important;
    background-image: linear-gradient(white, white), 
                      linear-gradient(135deg, var(--theme-decor-primary), var(--theme-decor-secondary)) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
}

.theme-ramadhan .category-item::before {
    content: '☪';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    opacity: 0.2;
    color: var(--theme-decor-primary);
    animation: float 6s ease-in-out infinite;
}

/* Lebaran Theme Specific */
.theme-lebaran {
    --theme-decor-primary: #FFD700;
    --theme-decor-secondary: #FFA500;
}

.theme-lebaran .welcome-card::before {
    content: '✨';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 64px;
    z-index: 5;
    opacity: 0.15;
    animation: sparkle 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}

.theme-lebaran .welcome-card::after {
    content: '🎊';
    position: absolute;
    bottom: 30px;
    left: 20px;
    font-size: 48px;
    z-index: 5;
    opacity: 0.15;
    animation: float 4s ease-in-out infinite;
}

/* Lebaran Card Corner Decorations - Rounded festive style */
.theme-lebaran .card,
.theme-lebaran .product-card {
    position: relative;
    overflow: visible !important;
}

.theme-lebaran .card::before,
.theme-lebaran .product-card::before {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--theme-decor-primary) 0%, var(--theme-decor-secondary) 100%);
    border-radius: 50% 50% 0 50%;
    z-index: 10;
    opacity: 0.85;
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.4);
}

.theme-lebaran .card::after,
.theme-lebaran .product-card::after {
    content: '◈';
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 12px;
    color: white;
    z-index: 11;
    animation: rotate 6s linear infinite;
}

/* Lebaran Quick Actions - Scalloped border effect */
.theme-lebaran .quick-action {
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), 
                      repeating-linear-gradient(45deg, var(--theme-decor-primary), var(--theme-decor-primary) 10px, var(--theme-decor-secondary) 10px, var(--theme-decor-secondary) 20px);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    position: relative;
}

.theme-lebaran .quick-action::before {
    content: '✦';
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 10px;
    color: var(--theme-decor-secondary);
    opacity: 0.7;
    animation: sparkle 2s ease-in-out infinite;
}

/* Lebaran Category Items */
.theme-lebaran .category-item {
    position: relative;
    border: 2px solid transparent !important;
    background-image: linear-gradient(white, white), 
                      repeating-linear-gradient(45deg, var(--theme-decor-primary), var(--theme-decor-primary) 8px, var(--theme-decor-secondary) 8px, var(--theme-decor-secondary) 16px) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
}

.theme-lebaran .category-item::before {
    content: '✨';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 16px;
    opacity: 0.25;
    animation: sparkle 2s ease-in-out infinite;
}

/* Theme Badge */
.theme-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: #DF63A1;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    animation: slideIn 0.6s ease-out;
    border: 2px solid rgba(223, 99, 161, 0.2);
}

/* Slide animation synced with 4-second banner autoplay */
.theme-badge-fade {
    animation: badgeSlideInOut 4.8s ease-in-out infinite;
}

.theme-ramadhan .theme-badge {
    border-left: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 250, 230, 0.6));
}

/* Badge style can also be applied directly via class (for countdown before theme starts) */
.theme-badge.badge-ramadhan {
    border-left: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 250, 230, 0.6));
}

.theme-lebaran .theme-badge {
    border-left: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 245, 230, 0.85));
}

.theme-badge.badge-lebaran {
    border-left: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 245, 230, 0.85));
}

/* Special Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(8deg);
    }
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.4;
    }
    25% {
        transform: scale(1.3) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 0.4;
    }
    75% {
        transform: scale(1.3) rotate(270deg);
        opacity: 0.8;
    }
}

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

@keyframes slideIn {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Badge slide animation - synced with Swiper banner (4.8s total cycle)
   Swiper config: delay=4000ms (static), speed=800ms (transition)
   Total cycle: 4000ms + 800ms = 4800ms
   
   Timeline:
   - 0-800ms (0-16.67%): Banner TRANSITION - Badge SLIDE IN
   - 800-4000ms (16.67-83.33%): Banner STATIC - Badge VISIBLE (3200ms)
   - 4000-4200ms (83.33-87.5%): Badge SLIDE OUT (200ms)
   - 4200-4800ms (87.5-100%): Badge HIDDEN waiting for next transition (600ms)
*/
@keyframes badgeSlideInOut {
    0% {
        transform: translateX(-120%);
        opacity: 0;
    }
    16.67% {
        transform: translateX(0);
        opacity: 1;
    }
    83.33% {
        transform: translateX(0);
        opacity: 1;
    }
    87.5% {
        transform: translateX(-120%);
        opacity: 0;
    }
    100% {
        transform: translateX(-120%);
        opacity: 0;
    }
}

/* Countdown Badge (for special themes) */
.theme-countdown {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: #DF63A1;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(223, 99, 161, 0.2);
}

/* Slide animation synced with 4-second banner autoplay */
.theme-countdown-fade {
    animation: countdownSlideInOut 4.8s ease-in-out infinite;
}

.theme-ramadhan .theme-countdown {
    border-right: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 250, 230, 0.6), rgba(255, 255, 255, 0.6));
}

/* Countdown style can also be applied directly via class (for countdown before theme starts) */
.theme-countdown.badge-ramadhan {
    border-right: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 250, 230, 0.6), rgba(255, 255, 255, 0.6));
}

.theme-lebaran .theme-countdown {
    border-right: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 245, 230, 0.85), rgba(255, 255, 255, 0.85));
}

.theme-countdown.badge-lebaran {
    border-right: 4px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 245, 230, 0.85), rgba(255, 255, 255, 0.85));
}

/* Countdown slide animation - synced with Swiper banner (4.8s total cycle)
   Same timing as badge, but slides from right side
   - 0-800ms: Slide IN during banner transition
   - 800-4000ms: VISIBLE during banner static
   - 4000-4200ms: Slide OUT before next transition
   - 4200-4800ms: HIDDEN during next transition
*/
@keyframes countdownSlideInOut {
    0% {
        transform: translateX(120%);
        opacity: 0;
    }
    16.67% {
        transform: translateX(0);
        opacity: 1;
    }
    83.33% {
        transform: translateX(0);
        opacity: 1;
    }
    87.5% {
        transform: translateX(120%);
        opacity: 0;
    }
    100% {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* Quick Action Theme Colors */
.quick-actions .quick-action {
    transition: all 0.3s ease;
}

.quick-actions .quick-action:active {
    transform: scale(0.95);
}

/* Bestseller/Terlaris Badge Animation */
.bestseller-badge {
    animation: badgePulse 2s ease-in-out infinite, badgeGlow 3s ease-in-out infinite !important;
}

.bestseller-badge i {
    animation: fireFlicker 1.5s ease-in-out infinite !important;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes badgeGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.7), 0 0 20px rgba(245, 158, 11, 0.3);
    }
}

@keyframes fireFlicker {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.15) rotate(0deg);
        opacity: 1;
    }
    75% {
        transform: scale(1.1) rotate(5deg);
        opacity: 0.9;
    }
}

/* Responsive adjustments for theme elements */
@media (max-width: 768px) {
    .theme-badge {
        font-size: 11px;
        padding: 6px 14px;
    }
    
    .theme-countdown {
        font-size: 10px;
        padding: 5px 12px;
    }
    
    .theme-ramadhan .welcome-card::before {
        font-size: 54px;
        top: 15px;
        right: 15px;
    }
    
    .theme-ramadhan .welcome-card::after {
        font-size: 36px;
        bottom: 20px;
        left: 15px;
    }
    
    .theme-lebaran .welcome-card::before {
        font-size: 48px;
        top: 15px;
        right: 15px;
    }
    
    .theme-lebaran .welcome-card::after {
        font-size: 36px;
        bottom: 20px;
        left: 15px;
    }
    
    .theme-ramadhan .card::before,
    .theme-ramadhan .product-card::before {
        width: 20px;
        height: 20px;
    }
    
    .theme-lebaran .card::before,
    .theme-lebaran .product-card::before {
        width: 24px;
        height: 24px;
    }
}

/* Regular Theme - No decorations, clean design */
.theme-regular .card::before,
.theme-regular .card::after,
.theme-regular .product-card::before,
.theme-regular .product-card::after,
.theme-regular .quick-action::before {
    display: none;
}

/* Smooth color transitions when theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Preserve animation performance */
.swiper-slide img,
.quick-action i {
    transition: transform 0.3s ease !important;
}
