/* ==========================================
   TSIKINIAINA SHOP - GESTION DE STOCK
   Design Moderne & Mobile First
   ========================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #6366f1;
    --info-light: #e0e7ff;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ==========================================
   LOGIN PAGE - MOBILE FIRST
   ========================================== */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 16px;
}

.login-box {
    background: white;
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-logo i { font-size: 28px; color: #4c1d95; }

.login-box h1 {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

.login-form { text-align: left; }

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.input-group:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

.input-group i { color: var(--gray-400); font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }
.input-group input {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px; /* 16px minimum to prevent zoom on iOS */
    outline: none;
    color: var(--gray-800);
    min-height: 24px;
}
.input-group input::placeholder { color: var(--gray-400); }

/* ==========================================
   BUTTONS - MOBILE OPTIMIZED
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    min-height: 44px; /* Minimum touch target */
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    line-height: 1.2;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #4c1d95; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { box-shadow: 0 2px 8px rgba(99,102,241,0.4); }

.btn-success { background: var(--success); color: #4c1d95; }
.btn-success:hover { background: #059669; }
.btn-success:active { box-shadow: 0 2px 8px rgba(16,185,129,0.4); }

.btn-outline { background: white; color: var(--gray-600); border: 1.5px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-outline:active { background: var(--gray-100); }

.btn-danger { background: var(--danger); color: #4c1d95; }
.btn-danger:hover { background: #dc2626; }

.btn-full { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }

.btn-sm { padding: 8px 16px; min-height: 36px; font-size: 13px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    background: transparent;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { background: var(--gray-100); color: var(--primary); }
.btn-icon:active { background: var(--gray-200); }
.btn-danger-icon:hover { background: var(--danger-light); color: var(--danger); }
.btn-danger-icon:active { background: #fecaca; }

/* ==========================================
   APP LAYOUT - MOBILE FIRST
   ========================================== */
.app {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

/* ==========================================
   SIDEBAR - MOBILE FIRST (hidden by default)
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b, #0f172a);
    color: #4c1d95;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}

.sidebar-open .sidebar {
    left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

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

.sidebar-open .sidebar-overlay {
    display: block;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}

.sidebar-logo i { font-size: 16px; color: #4c1d95; }
.sidebar-header h2 { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.sidebar-subtitle { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }

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

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    min-height: 44px;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #4c1d95; }
.sidebar-nav a.active { background: var(--primary); color: #4c1d95; box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.sidebar-nav a i { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-bottom: calc(12px + var(--safe-bottom));
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s ease;
    min-height: 44px;
}
.sidebar-footer a:hover { background: rgba(255,255,255,0.08); color: var(--danger); }

/* ==========================================
   MAIN CONTENT - MOBILE FIRST
   ========================================== */
.main {
    flex: 1;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 56px;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 16px;
    width: 40px;
    height: 40px;
    -webkit-tap-highlight-color: transparent;
}
.menu-toggle:hover { background: var(--gray-100); }
.menu-toggle:active { background: var(--gray-200); }

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topbar-title i { font-size: 18px; color: var(--primary); flex-shrink: 0; }

.content { 
    padding: 16px; 
    flex: 1;
    padding-bottom: calc(16px + var(--safe-bottom));
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

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

.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }

/* ==========================================
   STATS CARDS - MOBILE OPTIMIZED
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stats-2col { grid-template-columns: 1fr; }
.stats-4col { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.stat-card:active {
    transform: scale(0.98);
}

.stat-sm { 
    padding: 12px 14px; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 2px; 
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon i { font-size: 18px; }

.stat-info h3 { margin: 0; font-size: 20px; font-weight: 800; color: var(--gray-900); line-height: 1.2; }
.stat-info p { margin: 0; font-size: 12px; color: var(--gray-500); font-weight: 500; }

.stat-number { font-size: 20px; font-weight: 800; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 11px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }

.stat-blue .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-purple .stat-icon { background: var(--info-light); color: var(--info); }
.stat-teal .stat-icon { background: #ccfbf1; color: #14b8a6; }
.stat-gradient { background: linear-gradient(135deg, #6366f1, #8b5cf6); border: none; }
.stat-gradient .stat-icon { background: rgba(255,255,255,0.2); color: #4c1d95; }
.stat-gradient .stat-info h3 { color: #4c1d95; }
.stat-gradient .stat-info p { color: rgba(255,255,255,0.8); }
.stat-gradient2 { background: linear-gradient(135deg, var(--success), #059669); border: none; }
.stat-gradient2 .stat-icon { background: rgba(255,255,255,0.2); color: #4c1d95; }
.stat-gradient2 .stat-info h3 { color: #4c1d95; }
.stat-gradient2 .stat-info p { color: rgba(255,255,255,0.8); }

/* ==========================================
   SECTION TITLE
   ========================================== */
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 24px 0 12px;
}

/* ==========================================
   CATEGORY CARDS - MOBILE OPTIMIZED
   ========================================== */
.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

.category-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-top: 3px solid var(--cat-color);
    transition: all 0.2s ease;
    display: block;
    -webkit-tap-highlight-color: transparent;
}
.category-card:active { 
    box-shadow: var(--shadow-md); 
    transform: scale(0.99);
}

.category-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.category-header i { font-size: 24px; color: var(--cat-color); width: 28px; text-align: center; }
.category-header h3 { font-size: 17px; font-weight: 700; color: var(--gray-900); }

.category-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-stat { display: flex; flex-direction: column; }
.cat-label { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.cat-value { font-size: 15px; font-weight: 700; color: var(--gray-800); }

/* ==========================================
   ACTIONS BAR - MOBILE OPTIMIZED
   ========================================== */

/* ==========================================
   TOP NAVIGATION BAR - PREMIUM GLASS STYLE
   ========================================== */
.top-nav {
    display: flex;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #e8d5ff, #d4bfff, #ede3ff);
    position: sticky;
    top: 0;
    z-index: 50;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(107,33,168,.12), inset 0 1px 0 rgba(255,255,255,.6);
    border-bottom: 1px solid rgba(139,92,246,.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.top-nav::-webkit-scrollbar { display: none; }
.top-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #5b21b6;
    text-decoration: none;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    letter-spacing: .4px;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}
.top-nav-link::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(139,92,246,.02));
    opacity: 0;
    transition: opacity .3s ease;
}
.top-nav-link:hover {
    color: #4c1d95;
    background: rgba(139,92,246,.1);
    border-color: rgba(139,92,246,.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107,33,168,.15);
}
.top-nav-link:hover::before {
    opacity: 1;
}
.top-nav-link.active {
    background: linear-gradient(135deg, #7c3aed, #6d28d9, #5b21b6);
    color: #faf5ff;
    font-weight: 600;
    border-color: rgba(255,255,255,.25);
    box-shadow: 0 4px 15px rgba(99,102,241,.5), 0 0 0 0 rgba(139,92,246,.2);
    transform: translateY(-1px);
}
.top-nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #7c3aed, transparent);
    border-radius: 3px;
}
.top-nav-link.active:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6, #4c1d95);
    box-shadow: 0 8px 25px rgba(99,102,241,.6);
    transform: translateY(-2px);
}
.top-nav-link i {
    font-size: 16px;
    transition: transform .3s ease;
}
.top-nav-link:hover i {
    transform: scale(1.15);
}
.top-nav-link.active i {
    text-shadow: 0 0 10px rgba(255,255,255,.3);
}
@media (max-width: 768px) {
    .top-nav {
        padding: 10px 14px;
        gap: 6px;
        overflow-x: auto;
    }
    .top-nav-link {
        padding: 9px 16px;
        font-size: 12px;
        gap: 6px;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 10px;
    }
    .top-nav-link i {
        font-size: 14px;
    }
}
.actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.actions-bar::-webkit-scrollbar { display: none; }

.actions-bar .btn {
    flex-shrink: 0;
    font-size: 13px;
    padding: 10px 16px;
}

.search-form { 
    display: flex; 
    margin-left: auto;
    flex-shrink: 0;
    max-width: 100%;
}
.search-form input[type="text"] {
    padding: 10px 12px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: white;
    min-width: 140px;
    width: 100%;
    max-width: 100%;
    min-height: 42px;
}
.search-form input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.search-form .btn { 
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; 
    border-left: none;
    padding: 10px 14px;
}

/* ==========================================
   FORMS - MOBILE OPTIMIZED
   ========================================== */
.form-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 20px;
    margin-bottom: 16px;
}
.form-card-danger { border-left: 4px solid var(--danger); }

.form-card h3 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-card h3 i { color: var(--primary); font-size: 18px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.form-group input {
    padding: 12px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 16px; /* Prevent zoom on iOS */
    outline: none;
    transition: all 0.2s ease;
    background: white;
    min-height: 44px;
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: stretch;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.form-actions .btn {
    flex: 1;
    text-align: center;
}

/* ==========================================
   TABLE - MOBILE SWIPEABLE
   ========================================== */
.table-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 8px;
}

.table-header h3 { 
    font-size: 15px; 
    font-weight: 700; 
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.table-header h3 i { color: var(--primary); font-size: 16px; }
.table-count { 
    font-size: 12px; 
    color: var(--gray-500); 
    font-weight: 500; 
    background: var(--gray-100); 
    padding: 3px 10px; 
    border-radius: 20px;
    white-space: nowrap;
}

.table-actions { display: flex; align-items: center; gap: 10px; }

.inline-form select {
    padding: 8px 10px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: white;
    outline: none;
    cursor: pointer;
    min-height: 40px;
}
.inline-form select:focus { border-color: var(--primary); }

/* Swipeable table container */
.table-wrapper { 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    position: relative;
}

.table-wrapper::after {
    content: '← Faites glisser →';
    display: none;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #4c1d95;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    animation: pulse 2s ease-in-out infinite;
}

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

.table-wrapper:not(:hover)::after {
    display: block;
}

.table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 13px;
    min-width: 700px; /* Force horizontal scroll on mobile */
}

.table thead { background: var(--gray-50); }

.table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--gray-50);
    z-index: 2;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
    white-space: nowrap;
}

.table tbody tr:active { background: var(--gray-100); }
.table tbody tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--gray-400); padding: 40px 16px !important; font-size: 14px; }

/* ==========================================
   BADGES
   ========================================== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.badge-success { background: var(--success-light); color: #059669; }
.badge-danger { background: var(--danger-light); color: #dc2626; }
.badge-warning { background: var(--warning-light); color: #d97706; }
.badge-info { background: var(--info-light); color: var(--primary-dark); }

/* ==========================================
   UTILITIES
   ========================================== */
.text-green { color: var(--success) !important; font-weight: 600; }
.text-red { color: var(--danger) !important; font-weight: 600; }
code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ==========================================
   DESKTOP BREAKPOINTS
   ========================================== */
@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(6, 1fr); gap: 12px; }
    .stats-2col { grid-template-columns: repeat(2, 1fr); }
    .stats-4col { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 20px 24px; }
    .table-wrapper::after { display: none !important; }
}

@media (min-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        z-index: 100;
    }
    
    .sidebar-overlay { display: none !important; }
    
    
    
    .menu-toggle { display: none; }
    
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .form-grid { grid-template-columns: repeat(3, 1fr); }
    .content { padding: 24px 32px; }
    .table { min-width: 0; }
    .topbar-title { font-size: 20px; }
    
    /* Hover effects only on desktop */
    .stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
    .category-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
}

/* ==========================================
   LARGE DESKTOP
   ========================================== */
@media (min-width: 1400px) {
    .content { 
        max-width: 1400px; 
        margin: 0 auto;
        width: 100%;
    }
}

/* ==========================================
   PIN PROTECTION MODAL
   ========================================== */
.pin-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: pinFadeIn .3s ease;
}
@keyframes pinFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.pin-modal {
    background: #fff;
    border-radius: 24px;
    padding: 40px 32px 32px;
    width: 340px;
    max-width: 92vw;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,.35);
    animation: pinSlideUp .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pinSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(.95); }
    to { opacity: 1; transform: translateY() scale(1); }
}
.pin-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(124,58,237,.35);
}
.pin-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}
.pin-subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin: 0 0 24px;
}
.pin-display {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-bottom: 20px;
}
.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e2e8f;
    border: 2px solid #cbd5e1;
    transition: all .25s ease;
}
.pin-dot.filled {
    background: #7c3aed;
    border-color: #6d28d9;
    box-shadow: 0 0 12px rgba(124,58,237,.4);
    transform: scale(1.1);
}
.pin-error {
    display: none;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 8px;
    animation: pinShake .4s ease;
}
@keyframes pinShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}
.pin-input-wrap {
    display: flex;
    justify-content: center;
    margin: 0 auto 10px;
    max-width: 240px;
}
.pin-input {
    width: 100%;
    height: 56px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 18px;
    text-align: center;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: all .2s ease;
    padding: 0 10px;
    caret-color: #7c3aed;
}
.pin-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124,58,237,.15);
    background: #fff;
}
.pin-input::placeholder {
    letter-spacing: 6px;
    font-size: 16px;
    color: #cbd5e1;
}
@media (max-width: 480px) {
    .pin-modal {
        padding: 28px 20px 24px;
    }
    .pin-input {
        height: 50px;
        font-size: 24px;
        letter-spacing: 14px;
        border-radius: 12px;
    }
    .pin-display {
        gap: 10px;
    }
    .pin-dot {
        width: 12px;
        height: 12px;
    }
}

/* ==========================================
   LISTE LIVRAISON - FORMAT LIGNE
   ========================================== */
.livraison-list {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f;
    overflow: hidden;
    margin-top: 20px;
}
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f;
}
.list-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: ;
    display: flex;
    align-items: center;
    gap: 8px;
}
.list-header h3 i {
    color: #6366f1;
}
.list-count {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
}
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: .4;
}
.empty-state p {
    font-size: 15px;
    margin: ;
}

.livraison-ligne {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: all .2s ease;
    gap: 16px;
}
.livraison-ligne:last-child {
    border-bottom: none;
}
.livraison-ligne:hover {
    background: #f8fafc;
    transform: translateX(4px);
}

.livraison-separator {
    height: 4px;
    background: linear-gradient(to right, #e2e8f0, #94a3b8, #e2e8f0);
    border-radius: 4px;
    margin: 0 12px;
    box-shadow: 0 1px 3px rgba(10,16,23,0.1);
}
.livraison-ligne:last-child .livraison-separator {
    display: none;
}


.ligne-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: ;
}
.ligne-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: ;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ligne-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ligne-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 16px;
}
.ligne-info {
    min-width: ;
    flex: 1;
}
.ligne-produit {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ligne-date-soustitre {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 6px  2px ;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    width: fit-content;
}
.ligne-date-soustitre i {
    font-size: 14px;
    color: #3b82f6;
}

.ligne-lieu-soustitre {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin: 6px  2px ;
    padding: 4px 12px;
    background: #fef3c7;
    border-radius: 8px;
    width: fit-content;
}
.ligne-lieu-soustitre i {
    font-size: 13px;
    color: #d97706;
}
.ligne-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
}

    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
}

    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
}
.ligne-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ligne-meta i {
    font-size: 11px;
    color: #94a3b8;
}

.ligne-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: ;
}
.ligne-stat {
    text-align: center;
    min-width: 60px;
}
.ligne-qte {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #6366f1;
    line-height: 1.2;
}
.ligne-montant {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #059669;
    line-height: 1.2;
    white-space: nowrap;
}
.ligne-label {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 2px;
}
.ligne-prix .ligne-montant {
    color: #059669;
}
.ligne-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #64748b;
    gap: 2px;
}
.ligne-contact i {
    font-size: 14px;
    color: #6366f1;
}

@media (max-width: 768px) {
    .livraison-ligne {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
    }
    .ligne-left {
        width: 100%;
    }
    .ligne-right {
        width: 100%;
        justify-content: space-around;
        padding-top: 10px;
        border-top: 1px solid #f1f5f9;
    }
    .ligne-img {
        width: 36px;
        height: 36px;
    }
    .ligne-produit {
        font-size: 14px;
    }
    .ligne-qte {
        font-size: 18px;
    }
    .ligne-montant {
        font-size: 14px;
    }
}

/* === Boutons de statut (Livraison) === */
.btn-edit {
    background: none;
    border: none;
    color: var(--gray-400);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    font-size: 16px;
    text-decoration: none;
}
.btn-edit:hover {
    color: var(--primary);
    background: rgba(99,102,241,.1);
}

.btn-statut {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all .2s ease;
    color: #cbd5e1;
}
.btn-statut:hover {
    background: rgba(59, 130, 246, .1);
    color: #3b82f6;
}
.btn-statut.active {
    color: #3b82f6;
}

/* === Livraison filter tabs inline === */
.livraison-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.livraison-tabs .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 2px solid transparent;
    transition: all .2s ease;
    cursor: pointer;
    background: #f1f5f9;
    color: #64748b;
}
.livraison-tabs .tab-btn:hover {
    opacity: .85;
    transform: translateY(-1px);
}
.livraison-tabs .tab-btn.active {
    border-color: currentColor;
    font-weight: 600;
}
.livraison-tabs .tab-btn[href*="a_livrer"] {
    background: #ef2fe;
    color: #0284c7;
}
.livraison-tabs .tab-btn[href*="a_livrer"].active {
    background: #0284c7;
    color: #fff;
    border-color: #0284c7;
}
.livraison-tabs .tab-btn[href*="termine"] {
    background: #dcfce7;
    color: #16a34a;
}
.livraison-tabs .tab-btn[href*="termine"].active {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.livraison-tabs .tab-btn[href*="annule"] {
    background: #fee2e2;
    color: #dc2626;
}
.livraison-tabs .tab-btn[href*="annule"].active {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

/* === Livraison footer (contact + total + actions) === */
.ligne-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f;
}
.ligne-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}
