/**
 * ============================================================
 * style.css — Main Stylesheet for OnlineDukan E-Commerce
 * ============================================================
 * This stylesheet uses:
 *   - CSS Custom Properties (variables) for consistent theming
 *   - CSS Grid for product layouts
 *   - Flexbox for navigation and component layouts
 *   - Media queries for responsive design
 *   - NO external frameworks — everything is built from scratch
 * 
 * TABLE OF CONTENTS:
 *   1. CSS Variables (Custom Properties)
 *   2. Reset & Base Styles
 *   3. Typography
 *   4. Layout Utilities
 *   5. Buttons
 *   6. Forms
 *   7. Alerts / Flash Messages
 *   8. Site Header & Navigation
 *   9. Hero Section
 *  10. Category Filter
 *  11. Product Grid & Cards
 *  12. Product Detail Page
 *  13. Shopping Cart Page
 *  14. Checkout Page
 *  15. Auth Pages (Login/Register)
 *  16. Admin Panel Styles
 *  17. Footer
 *  18. Responsive Design (Media Queries)
 * ============================================================
 */

/* ============================================================
   1. CSS VARIABLES (Custom Properties)
   ============================================================
   Define colors, fonts, and spacing in one place.
   Change these to instantly re-theme the entire site!
*/
:root {
    /* Primary Colors */
    --primary-color: #2563eb;        /* Blue — main brand color */
    --primary-hover: #1d4ed8;        /* Darker blue for hover states */
    --primary-light: #dbeafe;        /* Light blue for backgrounds */

    /* Secondary Colors */
    --secondary-color: #64748b;      /* Slate gray */
    --secondary-hover: #475569;

    /* Status Colors */
    --success-color: #16a34a;        /* Green — success messages */
    --success-bg: #f0fdf4;
    --error-color: #dc2626;          /* Red — error messages */
    --error-bg: #fef2f2;
    --warning-color: #d97706;        /* Orange — warnings */
    --warning-bg: #fffbeb;
    --info-color: #2563eb;           /* Blue — info messages */
    --info-bg: #eff6ff;

    /* Neutral Colors */
    --text-color: #1e293b;           /* Dark slate — main text */
    --text-light: #64748b;           /* Gray — secondary text */
    --bg-color: #f8fafc;             /* Very light gray — page background */
    --white: #ffffff;
    --border-color: #e2e8f0;         /* Light gray — borders */
    --shadow-color: rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --font-size-3xl: 40px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 1px 2px var(--shadow-color);
    --shadow-md: 0 4px 6px var(--shadow-color);
    --shadow-lg: 0 10px 25px var(--shadow-color);

    /* Layout */
    --max-width: 1200px;
    --header-height: 70px;
}

/* ============================================================
   ANIMATION VARIABLES & KEYFRAMES
   ============================================================
   Purposeful motion — enhances feedback, not decoration.
   All animations respect prefers-reduced-motion.
*/
:root {
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out:    cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

@keyframes badgeBounce {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

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

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

/* Page entrance — applied to <main> */
main {
    animation: fadeIn 0.35s var(--ease-out-quart) both;
}

/* Hero section entrance */
.hero-content {
    animation: fadeInUp 0.6s var(--ease-out-expo) both;
}

.hero-content h1 {
    animation: fadeInUp 0.6s var(--ease-out-expo) 0.05s both;
}

.hero-content p {
    animation: fadeInUp 0.6s var(--ease-out-expo) 0.12s both;
}

.hero-content .btn-hero {
    animation: fadeInUp 0.6s var(--ease-out-expo) 0.2s both;
}

/* Category filter entrance */
.category-filter {
    animation: fadeInUp 0.5s var(--ease-out-quart) 0.1s both;
}

/* Product cards stagger via nth-child */
.product-card {
    animation: scaleIn 0.4s var(--ease-out-quart) both;
}
.product-card:nth-child(1)  { animation-delay: 0.05s; }
.product-card:nth-child(2)  { animation-delay: 0.10s; }
.product-card:nth-child(3)  { animation-delay: 0.15s; }
.product-card:nth-child(4)  { animation-delay: 0.20s; }
.product-card:nth-child(5)  { animation-delay: 0.25s; }
.product-card:nth-child(6)  { animation-delay: 0.30s; }
.product-card:nth-child(n+7){ animation-delay: 0.35s; }

/* Auth card entrance */
.auth-card {
    animation: scaleIn 0.4s var(--ease-out-expo) both;
}

/* Stat cards stagger */
.stat-card:nth-child(1) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.05s both; }
.stat-card:nth-child(2) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.10s both; }
.stat-card:nth-child(3) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.15s both; }
.stat-card:nth-child(4) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.20s both; }

/* Alert / flash message entrance */
.alert {
    animation: slideDown 0.3s var(--ease-out-quart) both;
}

/* Order card expand animation */
.user-order-details,
.order-details {
    animation: fadeInUp 0.25s var(--ease-out-quart) both;
}

/* Cart badge bounce when updated */
.cart-badge {
    animation: badgeBounce 0.4s var(--ease-out-quart) both;
}

/* Button active press feedback */
.btn:active:not(.btn-disabled) {
    transform: scale(0.97);
    transition: transform 0.1s var(--ease-in-out);
}

/* Filter button transition */
.filter-btn {
    transition: all 0.2s var(--ease-out-quart);
}

/* Nav link transition */
.nav-link,
.admin-link {
    transition: all 0.18s var(--ease-out-quart);
}

/* Product detail image subtle zoom on load */
.detail-img {
    animation: fadeIn 0.5s var(--ease-out-quart) both;
    transition: transform 0.4s var(--ease-out-quart);
}

.detail-img:hover {
    transform: scale(1.02);
}

/* Order card hover lift */
.user-order-card {
    transition: box-shadow 0.2s var(--ease-out-quart), transform 0.2s var(--ease-out-quart);
}

.user-order-card:hover {
    transform: translateY(-2px);
}

/* Profile card entrance */
.profile-card,
.profile-edit-card {
    animation: fadeInUp 0.4s var(--ease-out-quart) both;
}
.profile-edit-card {
    animation-delay: 0.08s;
}

/* Checkout section entrance stagger */
.checkout-section:nth-child(1) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.05s both; }
.checkout-section:nth-child(2) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.12s both; }
.checkout-section:nth-child(3) { animation: fadeInUp 0.4s var(--ease-out-quart) 0.19s both; }

/* Order confirmation celebration */
.order-confirmation {
    animation: scaleIn 0.5s var(--ease-out-expo) both;
}

/* Empty state entrance */
.empty-state {
    animation: fadeInUp 0.5s var(--ease-out-quart) 0.1s both;
}

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

/* ============================================================
   FOCUS-VISIBLE STYLES (Accessibility)
   ============================================================
   Visible focus ring for keyboard navigation only.
   :focus-visible triggers on keyboard focus, not mouse clicks.
*/
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Remove default outline since we handle it with :focus-visible */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================================
   2. RESET & BASE STYLES
   ============================================================
   Remove default browser styling for consistency
*/
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Include padding/border in element width */
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
}

/* ============================================================
   4. LAYOUT UTILITIES
   ============================================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-xl);
    color: var(--text-color);
}

/* ============================================================
   5. BUTTONS
   ============================================================
   Reusable button styles used throughout the site
*/
.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
    color: var(--white);
}

.btn-hero {
    background-color: var(--white);
    color: var(--primary-color);
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-lg);
}

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

.btn-full {
    width: 100%;
    display: block;
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
}

.btn-small {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.btn-disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.btn-edit {
    background-color: var(--warning-color);
    color: var(--white);
}

.btn-edit:hover {
    background-color: #b45309;
    color: var(--white);
}

.btn-delete {
    background-color: var(--error-color);
    color: var(--white);
}

.btn-delete:hover {
    background-color: #b91c1c;
    color: var(--white);
}

.btn-add-cart {
    white-space: nowrap;
}

/* ============================================================
   6. FORMS
   ============================================================ */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-color);
    font-size: var(--font-size-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-group input[type="file"] {
    padding: var(--spacing-sm);
    border-style: dashed;
}

.form-row {
    display: flex;
    gap: var(--spacing-lg);
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.form-help {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.required {
    color: var(--error-color);
}

/* ============================================================
   7. ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) auto;
    max-width: var(--max-width);
    font-weight: 500;
    border-left: 4px solid;
}

.alert ul {
    margin: 0;
    padding-left: var(--spacing-lg);
    list-style: disc;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-color);
    border-color: var(--success-color);
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error-color);
    border-color: var(--error-color);
}

.alert-warning {
    background-color: var(--warning-bg);
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.alert-info {
    background-color: var(--info-bg);
    color: var(--info-color);
    border-color: var(--info-color);
}

/* ============================================================
   8. SITE HEADER & NAVIGATION
   ============================================================ */
.site-header {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.site-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.site-brand {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
}

.site-brand:hover {
    color: var(--primary-hover);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-link {
    color: var(--text-color);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.nav-cart {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--error-color);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-user {
    color: var(--text-light);
    font-weight: 500;
    padding: var(--spacing-sm);
}

.nav-admin {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.nav-register {
    background-color: var(--primary-color);
    color: var(--white) !important;
    border-radius: var(--radius-md);
}

.nav-register:hover {
    background-color: var(--primary-hover);
    color: var(--white) !important;
}

.nav-logout {
    color: var(--error-color);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: var(--spacing-sm);
}

/* ============================================================
   9. HERO SECTION
   ============================================================ */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: var(--white);
    padding: var(--spacing-2xl) var(--spacing-lg);
    text-align: center;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    color: var(--white);
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-md);
}

.hero p {
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xl);
}

/* ============================================================
   10. CATEGORY FILTER
   ============================================================ */
.category-filter {
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-sm);
}

.filter-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.filter-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* ============================================================
   11. PRODUCT GRID & CARDS
   ============================================================
   Uses CSS Grid for responsive product layout
*/
.product-section {
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-2xl);
    max-width: var(--max-width);
    margin: 0 auto;
}

/* CSS Grid: Responsive grid that auto-fills columns */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.product-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

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

.product-image-link {
    display: block;
    overflow: hidden;
    height: 220px;
    background-color: #f1f5f9;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.product-info {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-category {
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
    width: fit-content;
}

.product-name {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-sm);
}

.product-name a {
    color: var(--text-color);
    text-decoration: none;
}

.product-name a:hover {
    color: var(--primary-color);
}

.product-description {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.product-price {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.product-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.stock-info {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.stock-info.in-stock {
    color: var(--success-color);
}

.stock-info.out-of-stock {
    color: var(--error-color);
}

.stock-badge {
    display: inline-block;
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.stock-badge.in-stock {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.stock-badge.out-of-stock {
    background-color: var(--error-bg);
    color: var(--error-color);
}

/* ============================================================
   12. PRODUCT DETAIL PAGE
   ============================================================ */
.product-detail-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-lg);
}

.breadcrumb {
    padding: var(--spacing-md) 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-bottom: var(--spacing-lg);
}

.breadcrumb a {
    color: var(--primary-color);
}

.product-detail {
    display: flex;
    gap: var(--spacing-2xl);
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.product-detail-image {
    flex: 1;
    max-width: 500px;
}

.detail-img {
    width: 100%;
    border-radius: var(--radius-md);
    background-color: #f1f5f9;
}

.product-detail-info {
    flex: 1;
}

.detail-name {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-md);
}

.detail-price {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: var(--spacing-lg);
}

.detail-stock {
    margin-bottom: var(--spacing-lg);
}

.detail-description {
    margin-bottom: var(--spacing-xl);
}

.detail-description h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.detail-description p {
    line-height: 1.8;
}

.detail-actions {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

/* ============================================================
   13. SHOPPING CART PAGE
   ============================================================ */
.cart-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.cart-container h1 {
    margin-bottom: var(--spacing-xl);
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-xl);
}

.cart-table th,
.cart-table td {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.cart-table th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

.cart-table tr:last-child td {
    border-bottom: none;
}

.cart-table tr:hover {
    background-color: #f8fafc;
}

.cart-product-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.cart-quantity input {
    width: 60px;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: var(--font-size-base);
}

.cart-summary {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    max-width: 400px;
    margin-left: auto;
}

.cart-summary h3 {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    font-size: var(--font-size-lg);
}

.cart-total-row.grand-total {
    font-weight: 800;
    font-size: var(--font-size-xl);
    color: var(--primary-color);
    border-top: 2px solid var(--border-color);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.cart-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
}

.empty-message {
    font-size: var(--font-size-lg);
    color: var(--text-light);
    margin-bottom: var(--spacing-lg);
}

/* ============================================================
   14. CHECKOUT PAGE
   ============================================================ */
.checkout-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.checkout-container h1 {
    margin-bottom: var(--spacing-xl);
}

.checkout-section {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-xl);
}

.checkout-section h2 {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.order-summary-item:last-child {
    border-bottom: none;
}

.order-summary-total {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--primary-color);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
    border-top: 2px solid var(--border-color);
}

/* Order confirmation */
.order-confirmation {
    text-align: center;
    padding: var(--spacing-2xl);
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.order-confirmation h1 {
    color: var(--success-color);
    font-size: var(--font-size-2xl);
}

.order-number {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--primary-color);
    margin: var(--spacing-lg) 0;
}

/* ============================================================
   15. AUTH PAGES (Login / Register)
   ============================================================ */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 100px);
    padding: var(--spacing-xl) var(--spacing-lg);
}

.auth-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
}

.auth-title {
    text-align: center;
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-sm);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
}

.auth-form {
    margin-bottom: var(--spacing-lg);
}

.auth-link {
    text-align: center;
    color: var(--text-light);
    font-size: var(--font-size-sm);
}

.auth-link a {
    color: var(--primary-color);
    font-weight: 600;
}

.demo-credentials {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: var(--info-bg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
}

.demo-credentials p {
    margin-bottom: var(--spacing-xs);
    color: var(--text-color);
}

.demo-credentials code {
    background-color: var(--white);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-weight: 600;
}

/* ============================================================
   16. ADMIN PANEL STYLES
   ============================================================ */
.admin-body {
    background-color: #f1f5f9;
}

.admin-header {
    background-color: #1e293b;
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.admin-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.admin-brand {
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--white);
    text-decoration: none;
}

.admin-badge {
    background-color: var(--error-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: var(--spacing-xs);
}

.admin-nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.admin-link {
    color: rgba(255, 255, 255, 0.8);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
    text-decoration: none;
}

.admin-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.admin-link-logout {
    color: #fca5a5;
}

.admin-link-logout:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.admin-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: var(--font-size-xl);
    cursor: pointer;
}

.admin-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.admin-page-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-sm);
}

.admin-welcome {
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.stat-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 40px;
}

.stat-number {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-color);
}

.stat-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

/* Admin Section */
.admin-section {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.section-header h2 {
    margin-bottom: 0;
}

/* Admin Table */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-color);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tr:hover {
    background-color: #f8fafc;
}

.table-product-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

/* Admin Form */
.admin-form {
    max-width: 700px;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.current-image-preview {
    margin-top: var(--spacing-sm);
}

.preview-img {
    max-width: 200px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

/* Order Cards (Admin) */
.order-count {
    margin-bottom: var(--spacing-lg);
    color: var(--text-light);
}

.order-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.order-header:hover {
    background-color: #f8fafc;
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.order-id {
    font-weight: 700;
    font-size: var(--font-size-lg);
}

.order-customer {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.order-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.order-total {
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--primary-color);
}

.order-status {
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.status-pending {
    background-color: var(--warning-bg);
    color: var(--warning-color);
}

.status-processing {
    background-color: var(--info-bg);
    color: var(--info-color);
}

.status-completed {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.status-cancelled {
    background-color: var(--error-bg);
    color: var(--error-color);
}

.order-date {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.toggle-icon {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.order-details {
    padding: 0 var(--spacing-lg) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.order-items-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
}

.order-items-table th,
.order-items-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.order-items-table th {
    background-color: #f8fafc;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.status-form {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.status-form select {
    padding: var(--spacing-xs) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

/* ============================================================
   17. FOOTER
   ============================================================ */
.site-footer {
    background-color: #1e293b;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    margin-top: var(--spacing-2xl);
}

.site-footer p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: color 0.2s var(--ease-out-quart);
}

.footer-links a:hover {
    color: var(--white);
}

/* ============================================================
   18. RESPONSIVE DESIGN (Media Queries)
   ============================================================
   Breakpoints:
     - 768px: Tablet
     - 480px: Mobile
*/

/* --- Tablet (max-width: 768px) --- */
@media (max-width: 768px) {
    /* Navigation: Switch to mobile menu */
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: var(--white);
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-md);
        z-index: 999;
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Admin nav mobile */
    .admin-nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: #1e293b;
        padding: var(--spacing-md);
        z-index: 999;
    }

    .admin-nav-links.active {
        display: flex;
    }

    .admin-menu-toggle {
        display: block;
    }

    /* Hero section */
    .hero h1 {
        font-size: var(--font-size-2xl);
    }

    .hero p {
        font-size: var(--font-size-base);
    }

    /* Product detail: Stack vertically */
    .product-detail {
        flex-direction: column;
    }

    .product-detail-image {
        max-width: 100%;
    }

    /* Form rows: Stack vertically */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Cart table: Make scrollable */
    .cart-table {
        font-size: var(--font-size-sm);
    }

    .cart-summary {
        max-width: 100%;
    }

    /* Order header: Stack */
    .order-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-meta {
        width: 100%;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Section header */
    .section-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: flex-start;
    }

    /* Detail actions */
    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .btn {
        width: 100%;
        text-align: center;
    }
}

/* --- Mobile (max-width: 480px) --- */
@media (max-width: 480px) {
    /* Smaller product grid */
    .product-grid {
        grid-template-columns: 1fr;
    }

    /* Stats: single column */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Smaller padding */
    .admin-main {
        padding: var(--spacing-md);
    }

    .admin-form {
        padding: var(--spacing-md);
    }

    .auth-card {
        padding: var(--spacing-lg);
    }

    /* Cart actions stack */
    .cart-actions {
        flex-direction: column;
    }

    .cart-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Product actions stack */
    .product-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .product-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Status form stack */
    .status-form {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Action buttons stack */
    .action-buttons {
        flex-direction: column;
    }
}

/* ============================================================
   TOAST NOTIFICATION (for Add to Cart feedback)
   ============================================================ */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--success-color);
    color: var(--white);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background-color: var(--error-color);
}

/* ============================================================
   USER ORDER HISTORY PAGE (my_orders.php)
   ============================================================ */
.orders-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.orders-container h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-sm);
}

.orders-subtitle {
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
}

.user-orders-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.user-order-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.user-order-card:hover {
    box-shadow: var(--shadow-md);
}

.user-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.user-order-header:hover {
    background-color: #f8fafc;
}

.order-main-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.order-number {
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--text-color);
}

.order-date {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.order-summary-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.toggle-arrow {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    transition: transform 0.2s ease;
}

.user-order-details {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background-color: #fafbfc;
}

.user-order-details h4 {
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.order-items-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.order-item-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.order-item-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.order-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.order-item-name {
    font-weight: 600;
    color: var(--text-color);
}

.order-item-qty {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.order-item-price {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.item-unit-price {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.item-subtotal {
    font-weight: 700;
    color: var(--primary-color);
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    border-top: 2px solid var(--border-color);
    font-size: var(--font-size-lg);
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-lg);
}

.empty-state h2 {
    margin-bottom: var(--spacing-md);
}

/* Nav user link styling */
.nav-user-link {
    font-weight: 600;
    color: var(--primary-color) !important;
}

.nav-user-link:hover {
    background-color: var(--primary-light) !important;
}

/* Responsive for order history */
@media (max-width: 768px) {
    .user-order-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .order-summary-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .order-item-row {
        flex-wrap: wrap;
    }
    
    .order-item-price {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        margin-top: var(--spacing-sm);
        padding-top: var(--spacing-sm);
        border-top: 1px dashed var(--border-color);
    }
}

/* ============================================================
   USER PROFILE PAGE (profile.php)
   ============================================================ */
.profile-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.profile-container h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-xl);
}

.profile-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--spacing-xl);
    align-items: start;
}

/* Profile Card (Left Column) */
.profile-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.profile-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--white);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--white);
    color: var(--primary-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin: 0 auto var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.profile-basic h2 {
    color: var(--white);
    margin-bottom: var(--spacing-xs);
}

.profile-email {
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

.profile-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.profile-badge.user {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.profile-badge.admin {
    background-color: var(--warning-color);
    color: var(--white);
}

.profile-stats {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.profile-stats .stat-item {
    flex: 1;
    padding: var(--spacing-lg);
    text-align: center;
    border-right: 1px solid var(--border-color);
}

.profile-stats .stat-item:last-child {
    border-right: none;
}

.profile-stats .stat-value {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.profile-stats .stat-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.profile-actions {
    padding: var(--spacing-lg);
    text-align: center;
}

.profile-actions .btn {
    width: 100%;
}

/* Profile Edit Card (Right Column) */
.profile-edit-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-xl);
}

.profile-edit-card h3 {
    margin-bottom: var(--spacing-xs);
}

.form-subtitle {
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
}

.form-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: var(--spacing-md);
}

.form-section h4 {
    font-size: var(--font-size-base);
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary-light);
}

.input-disabled {
    background-color: #f1f5f9 !important;
    color: var(--text-light) !important;
    cursor: not-allowed;
}

/* Responsive Profile Page */
@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-card {
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .profile-stats {
        flex-direction: column;
    }
    
    .profile-stats .stat-item {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: var(--spacing-md);
    }
    
    .profile-stats .stat-item:last-child {
        border-bottom: none;
    }
}
