/* ============================================
   Emberly - Premium Candle E-Commerce Platform
   Custom CSS with Brown + Red Palette & Animations
   ============================================ */

/* ===== KEYFRAME ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes glow {
    from { opacity: 0.6; transform: scale(1); }
    to { opacity: 1; transform: scale(1.1); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(178, 34, 34, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(178, 34, 34, 0); }
    100% { box-shadow: 0 0 0 0 rgba(178, 34, 34, 0); }
}

@keyframes flicker {
    0% { transform: scaleY(1) translateX(0); opacity: 1; }
    25% { transform: scaleY(1.05) translateX(1px); opacity: 0.9; }
    50% { transform: scaleY(0.95) translateX(-1px); opacity: 1; }
    75% { transform: scaleY(1.02) translateX(0.5px); opacity: 0.95; }
    100% { transform: scaleY(1) translateX(0); opacity: 1; }
}

@keyframes bounceGentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes counterUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(178, 34, 34, 0.3); }
    50% { box-shadow: 0 0 40px rgba(178, 34, 34, 0.6); }
}

@keyframes flameBreathing {
    0%, 100% { box-shadow: 0 0 15px rgba(217, 79, 79, 0.2); }
    50% { box-shadow: 0 0 30px rgba(217, 79, 79, 0.5); }
}

/* ===== BASE STYLES ===== */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

::selection {
    background: #8B1E1E;
    color: white;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #F8F5F2;
}

::-webkit-scrollbar-thumb {
    background: #A67B5B;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6B3E26;
}

/* ===== GLASSMORPHISM ===== */
.glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: rgba(59, 36, 28, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 36, 28, 0.2);
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ===== PRODUCT CARDS ===== */
.product-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    background: #F8F5F2;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    transform: translateY(-8px) scale(1.03) rotateX(4deg);
    box-shadow: 0 20px 60px rgba(139, 30, 30, 0.15);
    border-color: #B22222;
}

.product-card .card-image-wrapper {
    overflow: hidden;
    position: relative;
}

.product-card:hover .card-image {
    transform: scale(1.1);
}

/* ===== BUTTON STYLES ===== */
.btn-primary {
    background: linear-gradient(135deg, #8B1E1E, #6B3E26);
    color: white;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(178, 34, 34, 0.4);
}

.btn-ember {
    background: linear-gradient(135deg, #8B1E1E, #B22222);
    color: white;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-ember:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(178, 34, 34, 0.5);
}

/* ===== FORM STYLES ===== */
.form-input {
    width: 100%;
    padding: 14px 18px;
    background: #F8F5F2;
    border: 2px solid #A67B5B;
    border-radius: 16px;
    transition: all 0.3s ease;
    outline: none;
    font-size: 1rem;
    color: #111111;
}

.form-input:focus {
    border-color: #8B1E1E;
    box-shadow: 0 0 0 4px rgba(139, 30, 30, 0.15);
    background: white;
}

.form-input.error {
    border-color: #B22222;
    box-shadow: 0 0 0 4px rgba(178, 34, 34, 0.1);
}

/* ===== FLASH MESSAGES ===== */
.flash-message {
    animation: slideUp 0.4s ease-out forwards;
}

/* ===== ORDER TRACKER ===== */
.tracker-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tracker-step .step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 2;
}

.tracker-step.completed .step-indicator {
    background: #10b981;
    color: white;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.tracker-step.active .step-indicator {
    background: #8B1E1E;
    color: white;
    box-shadow: 0 0 20px rgba(178, 34, 34, 0.4);
    animation: pulseGlow 2s infinite;
}

.tracker-step.pending .step-indicator {
    background: #A67B5B;
    color: #F8F5F2;
}

.tracker-line {
    position: absolute;
    top: 20px;
    left: 50%;
    right: -50%;
    height: 3px;
    background: #A67B5B;
    z-index: 1;
}

.tracker-step.completed .tracker-line {
    background: #10b981;
}

/* ===== STAR RATING ===== */
.star-rating {
    display: inline-flex;
    gap: 2px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #ddd;
    transition: color 0.2s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #8B1E1E;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #A67B5B;
    border-top-color: #8B1E1E;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== SKELETON LOADING ===== */
.skeleton {
    background: linear-gradient(90deg, #A67B5B 25%, #F8F5F2 50%, #A67B5B 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* ===== CART FLY ANIMATION ===== */
.cart-fly {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===== PRICE TAG ===== */
.price-tag {
    background: linear-gradient(135deg, #8B1E1E, #6B3E26);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===== DISCOUNT BADGE ===== */
.discount-badge {
    background: linear-gradient(135deg, #8B1E1E, #B22222);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    animation: pulseGlow 2s infinite;
}

/* ===== RESPONSIVE TABLE WRAPPER ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== MOBILE CARD CONVERSION ===== */
@media (max-width: 767px) {
    /* Table to cards conversion for admin tables */
    table .table-to-cards {
        display: block;
        background: white;
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }
    
    table .table-to-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
    }
    
    table .table-to-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6B3E26;
        font-size: 0.875rem;
    }
    
    table thead {
        display: none;
    }
    
    table tbody tr {
        display: block;
    }
}

/* ===== PARALLAX EFFECT ===== */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* ===== 3D TILT EFFECT ===== */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(2deg);
}

/* ===== ANIMATED COUNTERS ===== */
.counter {
    display: inline-block;
    animation: counterUp 0.6s ease-out forwards;
    opacity: 0;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    animation: slideInRight 0.4s ease-out forwards;
}

/* ===== IMAGE ZOOM ON HOVER ===== */
.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.6s ease;
}

.img-zoom:hover img {
    transform: scale(1.15);
}

/* ===== GRADIENT TEXT ===== */
.gradient-text {
    background: linear-gradient(135deg, #8B1E1E, #6B3E26);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== CUSTOM CHECKBOX ===== */
.custom-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #A67B5B;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.custom-checkbox:checked {
    background: #8B1E1E;
    border-color: #8B1E1E;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ===== RESPONSIVE GRID HELPERS ===== */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ===== HERO GRADIENT ===== */
.hero-gradient {
    background: linear-gradient(135deg, #3B241C, #8B1E1E, #1A1A1A);
}

/* ===== FLAME GLOW EFFECTS ===== */
.flame-glow {
    animation: flameBreathing 3s ease-in-out infinite;
}

/* ===== SIDEBAR ACTIVE LINK ===== */
.sidebar-active {
    border-left: 4px solid #B22222;
    background: rgba(178, 34, 34, 0.15);
    box-shadow: 0 0 15px rgba(178, 34, 34, 0.1);
}

/* ===== CTA PULSE ===== */
.cta-pulse {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ===== PRINT STYLES ===== */
@media print {
    .no-print { display: none !important; }
    body { background: white; }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .dark\:bg-dark-800 { background: #1A1A1A; }
    .dark\:text-cream-100 { color: #F8F5F2; }
}