/**
 * DigiShop Tunisia - Main Stylesheet
 * Modern Plati-inspired Design
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==================== VARIABLES ==================== */
:root {
    --primary: #f5a623;
    --primary-dark: #e09000;
    --secondary: #1a1a2e;
    --accent: #00d68f;
    --danger: #ff4757;
    --info: #3742fa;
    
    --bg: #f4f6f8;
    --bg-card: #ffffff;
    --bg-dark: #1a1a2e;
    --bg-input: #f0f2f5;
    
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-light: #ffffff;
    
    --border: #e5e7eb;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --font: 'Plus Jakarta Sans', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 50px;
    
    --nav-height: 60px;
    --bottom-height: 70px;
}

[data-theme="dark"] {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #252540;
    --text: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b80;
    --border: #2a2a40;
}

/* ==================== RESET ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: var(--nav-height);
    padding-bottom: var(--bottom-height);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ==================== NAVBAR ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 1000;
}

.nav-menu-btn {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-logo {
    font-size: 22px;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 2px;
}
.nav-logo span { color: var(--primary); }

.nav-search {
    flex: 1;
    max-width: 500px;
    position: relative;
    display: none;
}
.nav-search input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 14px;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.5); }
.nav-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.5);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.nav-btn {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.2); }

@media (min-width: 768px) {
    .nav-search { display: block; }
    .nav-search-mobile { display: none; }
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    transition: 0.2s;
    position: relative;
}
.bottom-nav-item i { font-size: 22px; }
.bottom-nav-item.active,
.bottom-nav-item:hover { color: var(--primary); }
.bottom-nav-item .badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

@media (min-width: 992px) {
    .bottom-nav { display: none; }
    body { padding-bottom: 0; }
}

/* ==================== SIDEBAR ==================== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: var(--bg-card);
    z-index: 1101;
    transform: translateX(-100%);
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}
.sidebar.active { transform: translateX(0); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-logo .icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.sidebar-close {
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-content { flex: 1; overflow-y: auto; padding: 8px 0; }

.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    font-weight: 500;
    transition: 0.2s;
}
.sidebar-item:hover { background: var(--bg-input); }
.sidebar-item i:first-child { margin-right: 12px; color: var(--text-muted); width: 20px; }
.sidebar-item i:last-child { color: var(--text-muted); font-size: 14px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-footer select,
.sidebar-footer button {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
}

/* ==================== MAIN CONTENT ==================== */
.main { padding: 16px; max-width: 600px; margin: 0 auto; }
.main.wide { max-width: 1200px; }
.main.full { max-width: 100%; padding: 16px 24px; }

@media (min-width: 992px) {
    .main.full { padding: 20px 40px; }
}

/* ==================== SECTION ==================== */
.section { margin-bottom: 24px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title { font-size: 20px; font-weight: 700; }
.section-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 6px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    transition: 0.2s;
}
.section-link:hover { background: var(--primary); color: white; }

/* ==================== CATEGORIES SCROLL ==================== */
.categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.category-card {
    flex-shrink: 0;
    width: 85px;
    text-align: center;
}
.category-icon {
    width: 72px;
    height: 72px;
    background: var(--bg-card);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    box-shadow: var(--shadow);
    font-size: 28px;
    color: var(--primary);
    transition: 0.2s;
}
.category-card:hover .category-icon { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.category-name { font-size: 12px; font-weight: 500; color: var(--text-secondary); }

/* ==================== PRODUCTS GRID ==================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 576px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 992px) { .products-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .products-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; } }

/* ==================== PRODUCTS SCROLL ==================== */
.products-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}
.products-scroll::-webkit-scrollbar { display: none; }
.products-scroll .product-card { flex-shrink: 0; width: 160px; }

/* ==================== PRODUCT CARD ==================== */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}
.product-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 40px rgba(245,166,35,0.2);
    border-color: var(--primary);
}

.product-img {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-input);
    overflow: hidden;
}
.product-img img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
}
.product-card:hover .product-img img { transform: scale(1.1); }

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.product-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: white;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    cursor: pointer;
}
.product-fav:hover, .product-fav.active { color: var(--danger); }

.product-info { padding: 12px; }
.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.product-price .currency { font-size: 14px; font-weight: 500; }
.product-price .old {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 6px;
    font-weight: 400;
}
.product-name {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.product-sold { font-size: 11px; color: var(--text-muted); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
    cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-input); }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-sm); }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.card-body { padding: 20px; }

/* ==================== AUTH ==================== */
.auth-container {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
}
.auth-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.auth-tabs {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    border-radius: 6px;
    transition: 0.2s;
}
.auth-tab.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow);
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.social-btns { display: flex; gap: 12px; }
.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
    transition: 0.2s;
}
.social-btn:hover { background: var(--bg-input); }

/* ==================== CART SIDEBAR ==================== */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.cart-overlay.active { opacity: 1; visibility: visible; }

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg-card);
    z-index: 1201;
    transform: translateX(100%);
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}
.cart-sidebar.active { transform: translateX(0); }

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.cart-title { font-size: 18px; font-weight: 700; }

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

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.cart-item-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-input);
}
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.cart-item-price { color: var(--primary); font-weight: 700; }
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.qty-btn {
    width: 28px;
    height: 28px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}
.cart-item-remove:hover { color: var(--danger); }

.cart-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}
.cart-total-price { color: var(--primary); }

.cart-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}
.cart-empty i { font-size: 64px; margin-bottom: 16px; display: block; }

/* ==================== CHECKOUT ==================== */
.checkout-section { padding: 16px; max-width: 900px; margin: 0 auto; }

.payment-methods { display: flex; flex-direction: column; gap: 12px; }
.payment-method {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.2s;
}
.payment-method:hover,
.payment-method.active { border-color: var(--primary); }
.payment-method input { display: none; }
.payment-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.payment-info { flex: 1; }
.payment-name { font-weight: 600; }
.payment-desc { font-size: 13px; color: var(--text-muted); }
.payment-check { color: var(--primary); font-size: 20px; opacity: 0; }
.payment-method.active .payment-check { opacity: 1; }

.payment-details {
    display: none;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-top: 16px;
}
.payment-details.active { display: block; }

.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}
.file-upload:hover { border-color: var(--primary); }
.file-upload i { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }
.file-upload input { display: none; }
.file-upload-text { font-size: 13px; color: var(--text-muted); }

/* ==================== ALERTS ==================== */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: rgba(0,214,143,0.1); color: var(--accent); border: 1px solid var(--accent); }
.alert-danger { background: rgba(255,71,87,0.1); color: var(--danger); border: 1px solid var(--danger); }
.alert-warning { background: rgba(245,166,35,0.1); color: var(--primary); border: 1px solid var(--primary); }

/* ==================== UTILITIES ==================== */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

.d-flex { display: flex; }
.d-none { display: none !important; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-height) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--secondary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transition: 0.3s;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--accent); }
.toast.error { background: var(--danger); }

@media (min-width: 992px) {
    .toast { bottom: 24px; }
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    padding: 24px 16px;
    text-align: center;
    background: var(--bg-card);
    margin: -16px -16px 24px;
}
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; }

/* ==================== ORDER STATUS ==================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}
.status-pending { background: rgba(245,166,35,0.15); color: var(--primary); }
.status-processing { background: rgba(55,66,250,0.15); color: var(--info); }
.status-completed { background: rgba(0,214,143,0.15); color: var(--accent); }
.status-cancelled { background: rgba(255,71,87,0.15); color: var(--danger); }
