/* ==========================================
   SNAXIFY - MAIN CSS STYLES
   ========================================== */

:root {
    /* Colors */
    --primary: #FF6B35;
    --primary-dark: #E55A24;
    --secondary: #00A86B;
    --secondary-light: #5FBD8F;
    --accent: #FFD60A;
    --accent-light: #FFE15D;
    --background: #F8FAFB;
    --surface: #FFFFFF;
    --surface-alt: #F5F7FA;
    --border: #E1E8ED;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --success: #00A86B;
    --danger: #FF4757;
    --warning: #FFC107;
    --info: #0084FF;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-primary: 'Poppins', sans-serif;
    --font-secondary: 'Inter', sans-serif;
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 200ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-primary);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    font-family: var(--font-display);
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.3rem;
}

p {
    color: var(--text-secondary);
}

/* ==========================================
   BUTTONS
   ========================================== */

button {
    font-family: var(--font-primary);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background-color: var(--surface-alt);
    color: var(--primary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
}

/* ==========================================
   NAVBAR
   ========================================== */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--surface) 0%, #FAFBFC 100%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo-section {
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
}

.logo-icon {
    font-size: 28px;
    animation: bounce 2s infinite;
}

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

.logo-text {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-display);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.location-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.location-display:hover {
    background-color: var(--accent-light);
}

.location-icon {
    font-size: 16px;
}

#locationText {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.nav-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cart-btn, .admin-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background-color: var(--surface-alt);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.cart-btn:hover, .admin-btn:hover {
    background-color: var(--accent-light);
    transform: scale(1.05);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--danger);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(0.5); }
    100% { transform: scale(1); }
}

/* ==========================================
   SEARCH & FILTER
   ========================================== */

.search-section {
    position: sticky;
    top: 64px;
    z-index: 99;
    background: linear-gradient(180deg, var(--surface) 0%, rgba(255,255,255,0.98) 100%);
    padding: 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.search-container {
    max-width: 1200px;
    margin: 0 auto 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.search-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background-color: var(--primary);
    color: white;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.search-btn:hover {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

.filter-chips {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 16px;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--surface);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
}

/* ==========================================
   HERO SECTION
   ========================================== */

.hero {
    max-width: 1200px;
    margin: 40px auto 30px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #FFE5DB 0%, #FFF4E6 50%, #E8F5E9 100%);
    border-radius: var(--radius-xl);
    animation: fadeInUp 0.6s ease;
}

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

.hero-content {
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-title .highlight {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.hero-subtitle .highlight-text {
    color: var(--primary);
    font-weight: 600;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    background-color: white;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   PROMOTIONS CAROUSEL
   ========================================== */

.promotions {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 16px;
}

.carousel-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

.promo-card {
    flex-shrink: 0;
    width: 280px;
    padding: 24px;
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    animation: slideInLeft 0.5s ease;
}

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

.promo-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.promo-card h3 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-family: var(--font-display);
}

.promo-card p {
    color: rgba(255,255,255,0.95);
    font-size: 0.95rem;
}

/* ==========================================
   PRODUCTS SECTION
   ========================================== */

.products-section {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 16px;
}

.section-title {
    margin-bottom: 30px;
}

.section-title h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-family: var(--font-display);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    animation: fadeIn 0.4s ease;
}

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

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

/* ==========================================
   PRODUCT CARD
   ========================================== */

.product-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    cursor: pointer;
    animation: scaleIn 0.3s ease;
}

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

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--surface-alt) 0%, #F0F4F8 100%);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

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

.product-image .badge-stock {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 12px;
    background-color: rgba(255, 71, 87, 0.9);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.product-image .badge-stock.available {
    background-color: rgba(0, 168, 107, 0.9);
}

.product-body {
    padding: 16px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-category {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.product-price .original {
    text-decoration: line-through;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    margin-right: 8px;
}

.product-footer {
    display: flex;
    gap: 8px;
}

.product-footer button {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.view-details-btn {
    background-color: var(--surface-alt);
    color: var(--text-primary);
}

.view-details-btn:hover {
    background-color: var(--accent-light);
}

.add-to-cart-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.add-to-cart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.add-to-cart-btn:disabled {
    background-color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================
   MODALS
   ========================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 999;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 1000;
    padding: 16px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--surface-alt);
    font-size: 24px;
    color: var(--text-primary);
    z-index: 10;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--accent-light);
    transform: rotate(90deg);
}

/* ==========================================
   CART SIDEBAR
   ========================================== */

.cart-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
}

.cart-sidebar.active {
    transform: translateX(0);
}

@media (max-width: 480px) {
    .cart-sidebar {
        max-width: 100%;
    }
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.cart-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.close-cart {
    width: 36px;
    height: 36px;
    font-size: 28px;
    color: var(--text-primary);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
    animation: slideInRight 0.3s ease;
}

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

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: white;
    color: var(--primary);
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.qty-btn:hover {
    background-color: var(--accent-light);
    border-color: var(--primary);
}

.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    font-size: 0.85rem;
}

.cart-item-remove {
    color: var(--danger);
    font-size: 18px;
}

.cart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.cart-footer {
    border-top: 1px solid var(--border);
    padding: 20px;
}

.coupon-section {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.coupon-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font-primary);
}

.apply-coupon-btn {
    padding: 10px 16px;
    background-color: var(--surface-alt);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 12px;
}

.apply-coupon-btn:hover {
    background-color: var(--accent-light);
}

.cart-summary {
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row span:last-child {
    font-weight: 600;
}

.discount-row {
    color: var(--success);
}

.discount-text {
    color: var(--success) !important;
}

.total-row {
    border-top: 2px solid var(--border);
    padding-top: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.checkout-btn, .payment-btn, .continue-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.checkout-btn:hover, .payment-btn:hover, .continue-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   CHECKOUT MODAL
   ========================================== */

.checkout-modal {
    max-width: 600px;
    padding: 30px;
}

.checkout-modal h2 {
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.order-summary-checkout {
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 24px 0;
}

/* ==========================================
   SUCCESS MODAL
   ========================================== */

.success-modal {
    text-align: center;
    padding: 40px 30px;
    max-width: 500px;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--success) 0%, var(--secondary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
    animation: successBounce 0.6s ease;
}

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

.success-modal h2 {
    color: var(--success);
    margin-bottom: 12px;
}

.success-modal p {
    margin-bottom: 24px;
    line-height: 1.6;
}

.order-id-box {
    background-color: var(--surface-alt);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.order-id-box .label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.order-id {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.delivery-message {
    background-color: #E8F5E9;
    color: var(--success);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .nav-container {
        padding: 10px;
        gap: 10px;
    }

    .logo-text {
        font-size: 20px;
    }

    .hero {
        margin: 24px 16px;
        padding: 30px 20px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .search-section {
        top: 56px;
    }

    .nav-container {
        padding: 8px;
    }

    .logo-icon {
        font-size: 24px;
    }

    .logo-text {
        font-size: 18px;
    }

    .cart-count {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .filter-chips {
        gap: 6px;
    }

    .filter-chip {
        padding: 6px 12px;
        font-size: 12px;
    }

    .promo-card {
        width: 240px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .checkout-modal {
        padding: 20px;
    }

    .success-modal {
        padding: 30px 20px;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--surface-alt);
}

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

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