@import 'https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css';
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* Enhanced Design System Variables */
:root {
    /* Primary Colors - Sophisticated Gradient Palette */
    --primary-50: #f0fdf9;
    --primary-100: #ccfbef;
    --primary-200: #99f6e0;
    --primary-300: #5eead4;
    --primary-400: #2dd4bf;
    --primary-500: #14b8a6;
    --primary-600: #0d9488;
    --primary-700: #0f766e;
    --primary-800: #115e59;
    --primary-900: #134e4a;
    
    /* Accent Colors */
    --accent-gold: #fbbf24;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-orange: #f59e0b;
    
    /* Neutral Grays */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Advanced Shadows with Color */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-colored: 0 20px 25px -5px rgba(20, 184, 166, 0.1), 0 8px 10px -6px rgba(20, 184, 166, 0.1);
    --shadow-glow: 0 0 20px rgba(20, 184, 166, 0.3), 0 0 40px rgba(20, 184, 166, 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    --gradient-luxury: linear-gradient(135deg, var(--accent-gold) 0%, #f59e0b 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, var(--primary-400) 0px, transparent 50%), 
                     radial-gradient(at 80% 0%, var(--accent-blue) 0px, transparent 50%), 
                     radial-gradient(at 0% 50%, var(--accent-purple) 0px, transparent 50%);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Enhanced Typography with Variable Font Features */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-feature-settings: 'cv11', 'ss01', 'ss02';
    font-variation-settings: 'opsz' 32;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
    min-height: 100vh;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Advanced Animations with Physics-Based Motion */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(20, 184, 166, 0.6);
    }
}

@keyframes morphBackground {
    0%, 100% {
        background: var(--gradient-mesh);
    }
    33% {
        background: radial-gradient(at 20% 80%, var(--accent-purple) 0px, transparent 50%), 
                    radial-gradient(at 80% 20%, var(--accent-emerald) 0px, transparent 50%), 
                    radial-gradient(at 40% 40%, var(--primary-400) 0px, transparent 50%);
    }
    66% {
        background: radial-gradient(at 60% 20%, var(--accent-blue) 0px, transparent 50%), 
                    radial-gradient(at 20% 60%, var(--accent-rose) 0px, transparent 50%), 
                    radial-gradient(at 80% 80%, var(--accent-gold) 0px, transparent 50%);
    }
}

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

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes magneticHover {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(var(--mouse-x, 0), var(--mouse-y, 0)) scale(1.05);
    }
}

/* Utility Classes with Enhanced Physics */
.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in-right {
    animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.glow {
    animation: glow 2s ease-in-out infinite;
}

.breathe {
    animation: breathe 4s ease-in-out infinite;
}

.morph-bg {
    animation: morphBackground 10s ease-in-out infinite;
}

/* Next-Generation Glass Morphism */
.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-colored);
    position: relative;
    overflow: hidden;
}

.glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Revolutionary Product Cards with Magnetic Hover */
.product-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px) saturate(180%);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-slow);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
}

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

.product-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-mesh);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02) rotateX(5deg);
    box-shadow: var(--shadow-2xl), var(--shadow-glow);
    border-color: var(--primary-300);
}

.product-card:hover::before {
    left: 100%;
}

.product-card:hover::after {
    opacity: 0.1;
}

/* Magnetic Hover Effect */
.magnetic {
    transition: transform var(--transition-normal);
}

.magnetic:hover {
    animation: magneticHover var(--transition-normal) forwards;
}

/* Ripple Effect for Buttons */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple-effect:active::before {
    width: 300px;
    height: 300px;
}

/* Enhanced Product Card Images */
.product-card img {
    transition: all var(--transition-slow);
    filter: brightness(1) contrast(1) saturate(1);
}

.product-card:hover img {
    transform: scale(1.1) rotateY(5deg);
    filter: brightness(1.1) contrast(1.1) saturate(1.2);
}

/* Next-Level Button Designs */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transform: translateZ(0);
}

.btn-primary::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-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

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

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
    backdrop-filter: blur(10px);
}

.btn-luxury {
    background: var(--gradient-luxury);
    color: white;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-luxury::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.btn-luxury:hover::after {
    transform: translateX(100%);
}

/* Advanced Form Controls with Micro-Interactions */
.custom-input, .custom-select {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    transition: all var(--transition-normal);
    font-size: 0.875rem;
    position: relative;
}

.custom-input:focus, .custom-select:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1), var(--shadow-glow);
    transform: scale(1.02);
}

/* Enhanced Receipt Container - fixed to right on desktop */
#receipt-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-2xl);
    transition: all var(--transition-normal);
}

.receipt-header {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    position: relative;
    overflow: hidden;
}

.receipt-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-mesh);
    opacity: 0.3;
}

/* Enhanced Receipt Score and Timer Cards */
.receipt-header .bg-white\/95 {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.receipt-header .bg-white\/95::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.receipt-header .bg-white\/95:hover::before {
    opacity: 1;
}

.receipt-header .bg-white\/95:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
}

/* Animated number transitions */
#spending-score, #timer {
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #1f2937 !important; /* Very dark gray for better readability */
}

/* Score color animations */
#spending-score.text-green-600 {
    color: #10b981 !important;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

#spending-score.text-blue-600 {
    color: #3b82f6 !important;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

#spending-score.text-yellow-600 {
    color: #f59e0b !important;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

#spending-score.text-red-600 {
    color: #ef4444 !important;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.receipt-content {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-400) transparent;
}

.receipt-content::-webkit-scrollbar {
    width: 6px;
}

.receipt-content::-webkit-scrollbar-track {
    background: transparent;
}

.receipt-content::-webkit-scrollbar-thumb {
    background: var(--primary-400);
    border-radius: 3px;
}

/* Enhanced Header with Parallax Effect */
header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-normal);
    position: relative;
    overflow: visible;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-mesh);
    opacity: 0.1;
    pointer-events: none;
}

/* Ensure mobile menu and its toggle are always clickable above decorative layers */
#mobile-menu-toggle { position: relative; z-index: 60; }

/* Mobile menu should overlay content (not push it down) */
@media (max-width: 768px) {
	#mobile-menu {
		position: absolute;
		top: calc(100% + 0.25rem);
		right: 1rem;
		left: auto;
		z-index: 60;
		width: min(90vw, 22rem);
		transform-origin: top right;
		transform: translateY(-6px) scale(0.98);
		opacity: 0;
		transition: transform 180ms var(--transition-bounce), opacity 160ms ease;
		pointer-events: none;
	}

	/* Make the mobile menu panel feel solid and connected */
	#mobile-menu .glass-dark {
		background: rgba(15, 23, 42, 0.98);
		border: 1px solid rgba(255, 255, 255, 0.08);
		box-shadow: 0 20px 40px rgba(0,0,0,0.3), var(--shadow-glow);
	}
}

/* Open state animation */
#mobile-menu.open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Backdrop behind mobile menu */
#mobile-menu-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 40;
}

/* Mobile menu item hover animations */
#mobile-menu .glass-dark a {
	position: relative;
	transition: color 180ms ease, transform 180ms ease;
	will-change: transform;
}

#mobile-menu .glass-dark a::after {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
	border-radius: 0.75rem;
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 180ms ease, transform 180ms ease;
	pointer-events: none;
}

#mobile-menu .glass-dark a:hover,
#mobile-menu .glass-dark a:focus-visible {
	transform: translateX(4px);
}

#mobile-menu .glass-dark a:hover::after,
#mobile-menu .glass-dark a:focus-visible::after {
	opacity: 1;
	transform: scale(1);
}

/* Revolutionary Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.quantity-controls:hover {
    box-shadow: var(--shadow-lg);
    transform: scale(1.05);
}

.quantity-controls button {
    background: transparent;
    border: none;
    padding: 0.5rem 0.75rem;
    color: var(--primary-600);
    font-weight: 600;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.quantity-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-100);
    transform: scaleX(0);
    transition: transform var(--transition-fast);
    transform-origin: left;
}

.quantity-controls button:hover:not(:disabled) {
    color: var(--primary-700);
    transform: scale(1.1);
}

.quantity-controls button:hover:not(:disabled)::before {
    transform: scaleX(1);
}

.quantity-controls button:active {
    transform: scale(0.95);
}

.quantity-input {
    border: none;
    background: transparent;
    text-align: center;
    width: 60px;
    padding: 0.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* Advanced Filter Container */
.filter-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.filter-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(20, 184, 166, 0.5), transparent);
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .product-card {
        margin-bottom: 1rem;
    }
    
    .filter-container {
        padding: 1rem;
        border-radius: var(--radius-xl);
    }
    
    .custom-input, .custom-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
}

/* Advanced Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Enhanced Ad Containers */
.ad-container, .ad-container-728x90 {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
    padding: 1rem;
    margin: 1rem 0;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.ad-container::before, .ad-container-728x90::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-mesh);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.ad-container:hover::before, .ad-container-728x90:hover::before {
    opacity: 0.05;
}

.ad-placeholder, .ad-placeholder-728x90 {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.ad-placeholder:hover, .ad-placeholder-728x90:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

/* Tooltip Enhancements */
.tooltip-container .tooltip-content {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    position: absolute;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    transform: translateY(10px);
}

/* Modal Enhancements */
.modal {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-2xl);
    transform: scale(0.9);
    transition: all var(--transition-bounce);
}

.modal:target .modal-content {
    transform: scale(1);
}

/* Success and Error States */
.success-glow {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    border-color: var(--accent-emerald);
    animation: glow 1s ease-in-out;
}

.error-glow {
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.5);
    border-color: var(--accent-rose);
    animation: glow 1s ease-in-out;
}

/* Luxury Card Enhancements */
.luxury-card {
    background: var(--gradient-luxury);
    color: white;
    position: relative;
    overflow: hidden;
}

.luxury-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.1) 2px,
        rgba(255, 255, 255, 0.1) 4px
    );
    animation: shimmer 3s linear infinite;
    pointer-events: none;
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #0f172a;
        --gray-100: #1e293b;
        --gray-800: #f1f5f9;
        --gray-900: #f8fafc;
    }
    
    body {
        background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary-900) 100%);
        color: var(--gray-100);
    }
}

/* Print Optimizations */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .glass, .glass-dark {
        background: white;
        backdrop-filter: none;
        border: 1px solid #ccc;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

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

/* Focus Indicators for Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-400);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .glass, .glass-dark {
        border-width: 2px;
    }
    
    .product-card {
        border-width: 2px;
    }
}

/* Custom styles */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.slide-in {
    animation: slideIn 0.5s ease-in-out;
}

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

/* Ensure body and main container don't scroll horizontally */ /* Only apply on mobile */
@media (max-width: 767px) {
    /* Ensure body and main container don't scroll horizontally */
    body, html {
        overflow-x: hidden;
    }
}
.main-container {
    @apply max-w-screen mx-auto overflow-x-hidden;
}

/* Only apply on mobile */
@media (max-width: 767px) {
    .tooltip-container .tooltip-content {
        left: 50%;
        transform: translateX(-50%);
        max-width: 90vw; /* Ensure it doesn't exceed the viewport width */
        word-wrap: break-word; /* Avoid long words causing overflow */
    }
}

/* Improved tooltip styles */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-container .tooltip-content {
    position: absolute;
    left: -10px;
    top: calc(100% + 12px);
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 0.8rem;
    line-height: 1.5;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 9999;
    min-width: 500px;
    max-width: 600px;
    white-space: normal;
    transform: translateY(-4px);
    pointer-events: none;
}

.tooltip-container .tooltip-content[style*="opacity: 1"] {
    pointer-events: auto;
}

.tooltip-container .tooltip-content::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 15px;
    border: 6px solid transparent;
    border-bottom-color: rgba(15, 23, 42, 0.95);
}

/* Info icon styles */
.info-icon {
    cursor: help;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
    padding: 6px;
    margin: 6px;
}

.info-icon:hover {
    background-color: rgb(191, 219, 254);
    transform: scale(1.1);
}

.info-icon:focus {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* Responsive tooltip positioning */
@media (max-width: 640px) {
    .tooltip-container .tooltip-content {
        left: 50%;
        transform: translateX(-50%) translateY(-4px);
        min-width: 400px;
        max-width: calc(100vw - 32px);
    }
    
    .tooltip-container .tooltip-content::before {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Apply specific adjustments on smaller screens */
@media (max-width: 767px) {
    .tooltip-container .tooltip-content {
        /* Dynamically adjust left offset to prevent overflow */
        left: clamp(5%, 50%, calc(100vw - 5%));
        transform: translateX(0); /* Avoid using 50% translate on mobile */
    }
}

/* Show tooltip on hover or focus */
.tooltip-container:hover .tooltip-content,
.tooltip-container:focus .tooltip-content {
    opacity: 1;
}

/* Star rating styles */
.star {
    font-size: 1.25rem;
    cursor: pointer;
}

/* Quantity controls styling */
.quantity-controls {
    display: flex;
    align-items: stretch;
    height: 2.5rem;
}

.quantity-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #f3f4f6;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease-in-out;
}

.quantity-controls button:hover:not(:disabled) {
    background-color: #e5e7eb;
}

.quantity-controls button:focus {
    outline: none;
    border-color: #0D652D;
    box-shadow: 0 0 0 1px #0D652D;
    z-index: 1;
}

.quantity-controls button:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.quantity-controls button:last-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

.quantity-input {
    -moz-appearance: textfield;
    border: 1px solid #e2e8f0;
    border-left: none;
    border-right: none;
    height: 2.5rem;
    width: 3rem;
    text-align: center;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.quantity-input:focus {
    outline: none;
    border-color: #0D652D;
    box-shadow: 0 0 0 1px #0D652D;
    z-index: 1;
}

/* Hide number input spinners */
.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Custom styles for dropdown and search box */
.custom-input, .custom-select {
    height: 2.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    width: 100%;
    margin-bottom: 0.5rem;
}

.custom-input:focus, .custom-select:focus {
    outline: none;
    border-color: #0D652D;
    box-shadow: 0 0 0 3px #0D652D;
}

.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.custom-input, .custom-select, .buy-button {
    height: 2.5rem;
}

.custom-input, .custom-select {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .custom-input, .custom-select {
        margin-bottom: 1rem;
    }

    .filter-container {
        padding: 1rem;
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        margin-bottom: 1.5rem;
    }

    .filter-group {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .filter-group > * {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .filter-container {
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    .filter-group {
        display: flex;
        gap: 1rem;
        flex: 1;
    }

    .filter-group > * {
        flex: 1;
    }
}

/* Receipt container styling */
#receipt-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 6rem);
}

.receipt-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: white;
}

.receipt-content {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-top: 0.5rem;
    padding-bottom: 160px;
}

.receipt-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1023px) {
    .receipt-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 1rem;
        background-color: white;
        border-top: 1px solid #e5e7eb;
    }

    #receipt-container {
        margin-bottom: 160px;
    }

    .receipt-content {
        padding-bottom: 180px;
    }
}

/* Fix receipt to the right side on desktop */
@media (min-width: 1024px) {
    #receipt-container {
        position: sticky;
        top: 96px; /* account for header height + spacing */
        height: calc(100vh - 128px);
    }
}

.ad-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 336px;
    height: 280px;
    background-color: #FFFFFF;
    border: 2px solid #0D652D;
    border-radius: 0.375rem;
    overflow: hidden;
    margin: 0;
}

.ad-container-728x90 {
    width: 100%;
    max-width: 728px;
    height: auto;
    min-height: 90px;
    aspect-ratio: 728 / 90;
    margin: 1rem auto;
    background-color: #FFFFFF;
    border: 2px solid #0D652D;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.ad-placeholder, .ad-placeholder-728x90 {
    background-color: #FFFFFF;
    transition: background-color 0.3s ease;
}

.ad-placeholder:hover, .ad-placeholder-728x90:hover {
    background-color: #DBEAFE;
}

@media (max-width: 768px) {
    .ad-container {
        max-width: 100%;
        height: auto;
        min-height: 280px;
        aspect-ratio: 336 / 280;
        margin: 1rem auto;
    }

    .ad-container-728x90 {
        max-width: 100%;
        aspect-ratio: auto;
        height: 90px;
    }
}

.ad-container-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding: 0;
}

.billionaire-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (min-width: 1024px) {
    .ad-container-wrapper {
        min-height: 400px;
    }

    .ad-container {
        @apply mx-auto;
    }

    .billionaire-section {
        margin-bottom: 1rem;
        padding-bottom: 0;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }

  .modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 90%;
    width: 500px;
    z-index: 1001;
  }

  #infoModal:target {
    display: block;
  }

  .close-button {
    position: absolute;
    right: 1rem;
    top: 1rem;
    text-decoration: none;
    color: #666;
  }

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

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stats-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 100px;
}

.stats-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.hero-gradient {
    background: linear-gradient(135deg, 
        var(--primary-600) 0%, 
        var(--primary-700) 25%, 
        var(--accent-purple) 75%, 
        var(--accent-blue) 100%);
}

/* Optimized mobile spacing */
@media (max-width: 768px) {
    .hero-gradient {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .hero-gradient .text-center > div:last-child {
        margin-bottom: 1rem !important;
    }
    
    .stats-card {
        padding: 0.5rem;
        min-width: 80px;
    }
    
    .billionaire-section {
        margin-bottom: 1rem !important;
    }
    
    .product-filters {
        padding: 0.75rem !important;
        margin-bottom: 1rem !important;
    }
}

/* Optimized responsive spacing for large screens */
@media (min-width: 1280px) {
    .billionaire-section {
        margin-bottom: 0.75rem;
    }
    
    main.container {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .product-filters {
        margin-bottom: 1rem;
    }
}

/* Extra large screen optimizations */
@media (min-width: 1536px) {
    .billionaire-section {
        margin-bottom: 0.5rem;
    }
    
    .hero-gradient {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    main.container {
        padding-top: 0.75rem;
    }
}

/* Optimized mobile spacing */
@media (max-width: 768px) {
    .hero-gradient {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .hero-gradient .text-center > div:last-child {
        margin-bottom: 1rem !important;
    }
    
    .stats-card {
        padding: 0.5rem;
        min-width: 80px;
    }
    
    .billionaire-section {
        margin-bottom: 1rem !important;
    }
    
    .product-filters {
        padding: 0.75rem !important;
        margin-bottom: 1rem !important;
    }
}

/* Optimized responsive spacing for large screens */
@media (min-width: 1280px) {
    .billionaire-section {
        margin-bottom: 0.75rem;
    }
    
    main.container {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .product-filters {
        margin-bottom: 1rem;
    }
}

/* Extra large screen optimizations */
@media (min-width: 1536px) {
    .billionaire-section {
        margin-bottom: 0.5rem;
    }
    
    .hero-gradient {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    main.container {
        padding-top: 0.75rem;
    }
}

/* Enhanced State Cards */
.state-card {
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.state-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(20px);
}

.state-indicator {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    animation: pulse-indicator 2s infinite;
}

@keyframes pulse-indicator {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.5);
    }
}

.impact-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.5rem;
    border-radius: 0 0 0.75rem 0.75rem;
}

.impact-stat {
    background: rgba(249, 250, 251, 0.5);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(229, 231, 235, 0.5);
}

/* Enhanced Modal Styling */
#state-modal {
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.3s ease-out;
}

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

#state-modal .relative.z-10 {
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Regional Color Legend */
.region-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.region-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.region-color {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Responsive enhancements for state cards */
@media (max-width: 768px) {
    .state-card {
        min-height: 100px;
        padding: 0.75rem;
    }
    
    .state-card h3 {
        font-size: 0.75rem;
    }
    
    .state-card p {
        font-size: 0.625rem;
    }
}

/* Interactive search and filter styling */
.filter-controls {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading state for states grid */
.states-loading {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.state-skeleton {
    height: 120px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.75rem;
}

/* Extra large screen optimizations */

/* Fixed Spending Summary Bar - always visible */
#spending-summary-bar {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.1);
}

/* Reserve space for the fixed bottom bar */
body {
    padding-bottom: 120px;
}

/* Mobile specific adjustments for the spending bar */
@media (max-width: 768px) {
    #spending-summary-bar {
        padding: 1rem;
    }
    
    #spending-summary-bar .grid {
        gap: 0.75rem;
    }
    
    body:has(#spending-summary-bar:not(.hidden)) {
        padding-bottom: 140px;
    }
}

/* Perfect Score Achievement Animations */
@keyframes perfectScoreReveal {
    0% {
        opacity: 0;
        transform: scale(0.8);
        backdrop-filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        backdrop-filter: blur(20px);
    }
}

@keyframes perfectScoreBounce {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(-90deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes perfectScoreRotate {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-10deg) scale(1.1);
    }
    50% {
        transform: rotate(0deg) scale(1.2);
    }
    75% {
        transform: rotate(10deg) scale(1.1);
    }
}

@keyframes perfectScoreGlow {
    0%, 100% {
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(255, 215, 0, 0.6);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 40px rgba(255, 255, 255, 1), 0 0 80px rgba(255, 215, 0, 0.9), 0 0 120px rgba(255, 215, 0, 0.6);
        transform: scale(1.05);
    }
}

@keyframes perfectScorePulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1) saturate(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.2) saturate(1.3);
    }
}

@keyframes badgeFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-10px) rotate(2deg);
    }
    66% {
        transform: translateY(-5px) rotate(-2deg);
    }
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 15px 40px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
        transform: scale(1.02);
    }
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px) rotate(-0.5deg); }
    20% { transform: translateX(2px) rotate(0.5deg); }
    30% { transform: translateX(-3px) rotate(-0.8deg); }
    40% { transform: translateX(3px) rotate(0.8deg); }
    50% { transform: translateX(-2px) rotate(-0.3deg); }
    60% { transform: translateX(2px) rotate(0.3deg); }
    70% { transform: translateX(-1px) rotate(-0.2deg); }
    80% { transform: translateX(1px) rotate(0.2deg); }
    90% { transform: translateX(-0.5px) rotate(-0.1deg); }
}

/* Perfect Score Overlay Styles */
.perfect-score-overlay {
    backdrop-filter: blur(20px);
    animation: perfectScoreReveal 2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.perfect-score-content {
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
}

.perfect-score-overlay .badge {
    transition: all 0.3s ease;
}

.perfect-score-overlay .badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 215, 0, 0.4);
}

/* Responsive Perfect Score Animation */
@media (max-width: 768px) {
    .perfect-score-content h1 {
        font-size: 3rem !important;
    }
    
    .perfect-score-content p {
        font-size: 1.5rem !important;
    }
    
    .perfect-score-content .perfect-score-icon {
        font-size: 6rem !important;
    }
    
    .perfect-score-content > div:nth-child(3) {
        font-size: 4rem !important;
    }
    
    .achievement-badges {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .badge {
        width: 200px !important;
    }
}