/* Custom styles for Dulce Flor - SaaS-style cake shop */

:root {
    --primary-color: #ec4899;
    --primary-hover: #db2777;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
}

* {
    font-family: 'Inter', sans-serif;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Footer animations */
.footer-section {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.footer-section.animate {
    opacity: 1;
    transform: translateY(0);
}

.footer-section:nth-child(1) { transition-delay: 0.1s; }
.footer-section:nth-child(2) { transition-delay: 0.2s; }
.footer-section:nth-child(3) { transition-delay: 0.3s; }
.footer-section:nth-child(4) { transition-delay: 0.4s; }

/* Filter button animations */
.filter-btn {
    color: #6b7280;
    background: transparent;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(236, 72, 153, 0.1), transparent);
    transition: left 0.6s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    color: var(--primary-color);
    background: #fce7f3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(236, 72, 153, 0.2);
}

.filter-btn.active {
    color: white;
    background: var(--primary-color);
    box-shadow: 0 5px 15px rgba(236, 72, 153, 0.4);
}

/* Scroll indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Page transitions */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.page-transition.active {
    opacity: 1;
    visibility: visible;
}

.page-transition .loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Notification improvements */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    backdrop-filter: blur(10px);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
    background: linear-gradient(135deg, #f0fdf4, #ffffff);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
    background: linear-gradient(135deg, #fef2f2, #ffffff);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
    background: linear-gradient(135deg, #fffbeb, #ffffff);
}

/* Hero Section Animations */
.hero-title {
    animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-buttons {
    animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-features {
    animation: fadeInUp 1s ease-out 0.6s both;
}

.hero-image {
    animation: fadeInRight 1s ease-out 0.3s both;
}

.hero-badge {
    animation: bounceIn 1s ease-out 1s both;
}

/* Floating animation for hero badge */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.floating {
    animation: float 3s ease-in-out infinite;
}

/* Feature cards animations */
.feature-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.feature-card.animate {
    opacity: 1;
    transform: translateY(0);
}

.feature-card:nth-child(1) { transition-delay: 0.1s; }
.feature-card:nth-child(2) { transition-delay: 0.2s; }
.feature-card:nth-child(3) { transition-delay: 0.3s; }

.feature-icon {
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotateY(180deg);
}

/* Product card animations */
.product-card {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.product-card.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.product-card .product-image {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

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

/* Staggered animation delays for products */
.product-card:nth-child(1) { transition-delay: 0.1s; }
.product-card:nth-child(2) { transition-delay: 0.2s; }
.product-card:nth-child(3) { transition-delay: 0.3s; }
.product-card:nth-child(4) { transition-delay: 0.4s; }
.product-card:nth-child(5) { transition-delay: 0.5s; }
.product-card:nth-child(6) { transition-delay: 0.6s; }
.product-card:nth-child(7) { transition-delay: 0.7s; }
.product-card:nth-child(8) { transition-delay: 0.8s; }

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new {
    background: #fef3c7;
    color: #92400e;
}

.badge-popular {
    background: #dbeafe;
    color: #1e40af;
}

.badge-sale {
    background: #fee2e2;
    color: #991b1b;
}

/* Cart item animations */
.cart-item {
    animation: slideInRight 0.3s ease-out;
}

/* Navigation animations */
.nav-item {
    position: relative;
    transition: all 0.3s ease;
}

.nav-item::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-item:hover::after {
    width: 100%;
}

/* Cart button pulse animation */
.cart-pulse {
    animation: cartPulse 0.6s ease-in-out;
}

@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Advanced keyframe animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-45deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) rotate(-45deg);
    }
    70% {
        transform: scale(0.9) rotate(-45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(-45deg);
    }
}

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

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal animations */
.modal-content {
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Button animations */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-animated:hover::before {
    left: 100%;
}

.btn-animated:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced loading states */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Intersection Observer animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease-out;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease-out;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Decorative background animations */
.hero-section::before {
    content: '';
    position: absolute;
    top: 10%;
    right: 10%;
    width: 100px;
    height: 100px;
    background: rgba(236, 72, 153, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    z-index: 0;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 20%;
    left: 5%;
    width: 60px;
    height: 60px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite reverse;
    z-index: 0;
}

/* Navbar blur effect */
.navbar-blur {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

/* Product grid stagger animation */
.products-grid-container .product-card:nth-child(even) {
    animation-delay: 0.1s;
}

.products-grid-container .product-card:nth-child(3n) {
    animation-delay: 0.2s;
}

/* Enhanced loading states */
.skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 1rem;
    height: 300px;
}

/* Interactive elements glow */
.glow-on-hover {
    position: relative;
    transition: all 0.3s ease;
}

.glow-on-hover:hover {
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

/* Floating action button style for cart */
.floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.3);
    animation: float 3s ease-in-out infinite;
}

/* Responsive animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Notification toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideUp 0.3s ease-out;
    z-index: 9999;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

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

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.form-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Checkout steps */
.checkout-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .checkout-steps {
        margin-bottom: 3rem;
    }
}

.step {
    display: flex;
    align-items: center;
    position: relative;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #6b7280;
    z-index: 2;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .step-circle {
        width: 40px;
        height: 40px;
    }
}

.step.active .step-circle {
    background: var(--primary-color);
    color: white;
}

.step.completed .step-circle {
    background: var(--success-color);
    color: white;
}

.step-line {
    width: 50px;
    height: 2px;
    background: #e5e7eb;
    margin: 0 0.5rem;
}

@media (min-width: 640px) {
    .step-line {
        width: 100px;
        margin: 0 1rem;
    }
}

.step.completed + .step-line {
    background: var(--success-color);
}

/* Price formatting */
.price {
    font-weight: 600;
    color: var(--primary-color);
}

.price-old {
    text-decoration: line-through;
    color: #9ca3af;
    font-weight: 400;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
    
    /* Adjust container padding on mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Fix price alignment in cart total */
    #cart-total {
        white-space: nowrap;
        overflow: visible;
        text-align: right;
        padding-right: 0.5rem;
    }
    
    /* Fix per-item price alignment on Checkout (mobile) */
    /* Wrap the quantity/price row so the price doesn't overflow off-screen */
    #checkout-items .flex-1 > .flex {
        flex-wrap: wrap;
    align-items: flex-start;
    }
    /* Move price to its own row, right aligned, and keep numbers on one line */
    #checkout-items .flex-1 > .flex > .text-right {
    width: 100%;
    flex: 0 0 100%; /* ensure its own line on wrap */
    order: 2;       /* keep it after the quantity block */
        text-align: right;
        margin-top: 0.5rem;
        white-space: nowrap;
    }
    
    /* Smaller badges on mobile */
    .badge {
        padding: 0.125rem 0.5rem;
        font-size: 0.625rem;
    }
    
    /* Adjust quantity selector for mobile */
    .quantity-selector {
        gap: 0.25rem;
    }
    
    .quantity-btn {
        width: 28px;
        height: 28px;
    }
    
    .quantity-input {
        width: 50px;
        font-size: 0.875rem;
    }
    
    /* Toast positioning for mobile */
    .toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
    
    /* Product card adjustments */
    .product-card {
        font-size: 0.875rem;
    }
    
    /* Form adjustments for mobile */
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Tablet specific adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Line clamp utility for text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Description expansion styles */
.expand-description-btn,
.expand-description-btn-order,
.expand-description-btn-upsell {
    transition: all 0.2s ease;
}

.expand-description-btn:hover,
.expand-description-btn-order:hover,
.expand-description-btn-upsell:hover {
    transform: translateY(-1px);
}

.description-full,
.description-full-order,
.description-full-upsell {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Emoji support */
.emoji {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

/* Order summary improvements */
.order-summary-item {
    transition: background-color 0.2s ease;
}

/* Upsell section styles */
.upsell-item {
    border: 2px solid #f3f4f6;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upsell-item:hover {
    border-color: #ec4899;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.15);
}

.upsell-item.selected {
    border-color: #ec4899;
    background-color: #fdf2f8;
}

.upsell-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.upsell-checkbox.checked {
    background-color: #ec4899;
    border-color: #ec4899;
}

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

.upsell-description-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.upsell-add-btn {
    background: linear-gradient(135deg, #ec4899, #f472b6);
    transition: all 0.2s ease;
}

.upsell-add-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.upsell-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.upsell-add-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.order-summary-item:hover {
    background-color: rgba(249, 250, 251, 0.5);
}

/* Ensure images don't cause overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Quantity selector */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
}

.quantity-input {
    width: 60px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.25rem;
}

/* Image gallery */
.image-gallery {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.gallery-thumb {
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    border-color: var(--primary-color);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}