/* CSS Variables & Reset */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    background-image: radial-gradient(at 40% 20%, hsla(250,100%,74%,0.15) 0px, transparent 50%),
                      radial-gradient(at 80% 0%, hsla(189,100%,56%,0.15) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography & Utilities */
h1, h2, h3 { font-weight: 600; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; background: none; font-family: 'Inter', sans-serif;}

/* Glassmorphism Header */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.navigation {
    display: flex;
    gap: 2rem;
}

.navigation a {
    font-weight: 500;
    transition: color 0.3s;
}

.navigation a:hover { color: var(--primary); }

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    height: 20px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 8rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: -webkit-linear-gradient(45deg, var(--primary), #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p { color: var(--text-muted); font-size: 1.1rem; }

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.product-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.add-to-cart-btn {
    background: var(--primary);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    margin-top: auto;
    transition: background 0.3s;
}

.add-to-cart-btn:hover { background: var(--primary-hover); }

/* Slide-in Cart */
.cart-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.cart-overlay.active { opacity: 1; visibility: visible; }

.cart-panel {
    position: fixed;
    top: 0; right: -400px;
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.cart-panel.active { right: 0; }

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.close-cart {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-cart {
    text-align: center;
    color: var(--text-muted);
    margin-top: 3rem;
    display: none;
}

.empty-cart i { font-size: 3rem; margin-bottom: 1rem; color: #d1d5db; }
.empty-cart.active { display: block; }

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 12px;
}

.cart-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.item-details { flex-grow: 1; }
.item-name { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.25rem; }
.item-price { font-size: 0.85rem; color: var(--primary); font-weight: 600; }

.item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.qty-btn {
    background: #e5e7eb;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover { background: #d1d5db; }
.item-qty { font-size: 0.85rem; width: 20px; text-align: center; }

.remove-btn {
    color: #ef4444;
    font-size: 1.2rem;
    margin-left: auto;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #d1d5db;
}

.checkout-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkout-btn:hover { background: var(--primary-hover); }

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2.5rem 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-icon { font-size: 4rem; margin-bottom: 1rem; }
.success-icon { color: #10b981; }
.error-icon { color: #ef4444; }

.modal-content h2 { margin-bottom: 0.5rem; }
.modal-content p { color: var(--text-muted); margin-bottom: 1.5rem; }

.payment-details {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: left;
    font-size: 0.9rem;
}

.payment-details p { margin-bottom: 0.5rem; color: var(--text-main); }

.modal-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 600;
}
.modal-btn.error-btn { background: #ef4444; }

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease forwards;
    min-width: 250px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .navigation { display: none; }
    .hero h1 { font-size: 2.2rem; }
    .cart-panel { width: 100%; right: -100%; }
}