/* =====================================================
   SUPÉRETTE MANAGER - PREMIUM DESIGN SYSTEM
   ===================================================== */

:root {
    /* Palette premium - Emerald & Charcoal */
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #10b981;
    --primary-bg: #ecfdf5;
    
    --secondary: #0f172a;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Neutres */
    --white: #ffffff;
    --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;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Rayons */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Layout */
    --sidebar-width: 280px;
    --topbar-height: 72px;
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.05);
    transform: translateX(0);
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-tagline {
    font-size: 11px;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    scrollbar-width: auto;
    scrollbar-color: #38bdf8 rgba(15, 23, 42, 0.72);
    scrollbar-gutter: stable;
}

.sidebar-nav::-webkit-scrollbar {
    width: 11px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.72);
    border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    min-height: 48px;
    background: linear-gradient(180deg, #38bdf8, #0ea5e9);
    border: 2px solid #172033;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7dd3fc, #38bdf8);
}

.sidebar-nav::-webkit-scrollbar-thumb:active {
    background: #bae6fd;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--gray-300);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    display: flex;
    justify-content: center;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--white);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: var(--primary-light);
    border-left: 3px solid var(--primary-light);
    padding-left: 11px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 14px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--gray-400);
    text-transform: capitalize;
}

.logout-btn {
    color: var(--gray-400);
    background: transparent;
    border: none;
    font-size: 18px;
    padding: 6px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    color: var(--gray-700);
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--white);
    border-color: var(--gray-300);
}

.sidebar-toggle-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-left: 6px;
}

html.sidebar-collapsed .sidebar,
body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

html.sidebar-collapsed .main-content,
body.sidebar-collapsed .main-content {
    margin-left: 0;
}

html.sidebar-collapsed .sidebar-toggle,
body.sidebar-collapsed .sidebar-toggle {
    display: inline-flex;
}

.breadcrumb {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.topbar-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 500;
    text-transform: capitalize;
}

.content-wrapper {
    flex: 1;
    padding: 32px;
}

/* =====================================================
   CARDS & STATS
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.success::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.danger::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card.info::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon.success { background: #d1fae5; color: #059669; }
.stat-icon.warning { background: #fef3c7; color: #d97706; }
.stat-icon.danger { background: #fee2e2; color: #dc2626; }
.stat-icon.info { background: #dbeafe; color: #2563eb; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.03em;
    line-height: 1.2;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.stat-sub {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.stat-change.up { background: #d1fae5; color: #059669; }
.stat-change.down { background: #fee2e2; color: #dc2626; }

/* =====================================================
   CARDS & PANELS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
    font-size: 20px;
}

.card-body {
    padding: 24px;
}

.card-body.p-0 {
    padding: 0;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 26px;
    font-size: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

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

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--gray-900);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

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

/* =====================================================
   TABLES
   ===================================================== */
.table-wrapper {
    overflow-x: auto;
}

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

.table thead th {
    background: var(--gray-50);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
    color: var(--gray-800);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

.table .text-right {
    text-align: right;
}

.table .text-center {
    text-align: center;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: var(--primary-bg); color: var(--primary-dark); }
.badge-secondary { background: var(--gray-100); color: var(--gray-700); }

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
}

.alert i {
    font-size: 18px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #3b82f6;
}

/* =====================================================
   TOAST NOTIFICATIONS (floating)
   ===================================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    display: flex;
    align-items: start;
    gap: 14px;
    min-width: 340px;
    border-left: 5px solid;
    pointer-events: auto;
    animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress 5s linear forwards;
}

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 18px;
    transition: all 0.2s;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.toast-success { border-left-color: #10b981; color: #059669; }
.toast-success .toast-title { color: #065f46; }

.toast-danger { border-left-color: #ef4444; color: #dc2626; }
.toast-danger .toast-title { color: #991b1b; }

.toast-warning { border-left-color: #f59e0b; color: #d97706; }
.toast-warning .toast-title { color: #92400e; }

.toast-info { border-left-color: #3b82f6; color: #2563eb; }
.toast-info .toast-title { color: #1e40af; }

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0; }
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0f172a 0%, #047857 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
}

.auth-container {
    margin: auto;
    width: 100%;
    max-width: 440px;
    padding: 40px;
    position: relative;
    z-index: 10;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--gray-500);
    font-size: 14px;
}

/* =====================================================
   POS / CAISSE
   ===================================================== */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 16px;
    height: calc(100vh - 140px);
}

.pos-products {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-search {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.pos-search .form-control {
    border-width: 1.5px;
    border-color: #cbd5e1;
    border-radius: 12px;
    min-height: 42px;
    font-weight: 500;
}

.pos-search .form-control:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.pos-products-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    align-content: flex-start;
}

.product-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid var(--gray-200);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
    position: relative;
}

.product-card:hover {
    border-color: #14b8a6;
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

/* Produit non régularisé (stock uniquement en dépôt RGL) */
.product-card-regul {
    border-color: #f97316;
    background: #fff7ed;
}
.product-card-regul:hover {
    border-color: #ea580c;
    box-shadow: 0 4px 16px rgba(249,115,22,0.25);
}

/* Produit mixte (stock normal + stock RGL) */
.product-card-mixed {
    border-color: #f59e0b;
}
.product-card-mixed:hover {
    border-color: #d97706;
    box-shadow: 0 4px 16px rgba(245,158,11,0.2);
}

.product-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 10px;
}

.product-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
}

.product-card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.product-card-stock {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
}

.pos-cart {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-cart-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f766e 100%);
    color: white;
}

.pos-cart-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 11px;
    color: var(--gray-500);
}

.cart-qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--gray-700);
    font-weight: 600;
}

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

.cart-qty {
    min-width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}

.cart-item-total {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    min-width: 75px;
    text-align: right;
}

.cart-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
}

.pos-cart-summary {
    padding: 16px 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    border-top: 1px solid var(--gray-200);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    padding-top: 10px;
    margin-top: 10px;
    border-top: 2px dashed var(--gray-300);
    letter-spacing: -0.02em;
}

.summary-total .amount {
    color: #0f766e;
}

.pos-cart-actions {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.pos-cart-actions .btn {
    border-radius: 12px;
}

.empty-cart {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-400);
}

.empty-cart i {
    font-size: 56px;
    margin-bottom: 12px;
    display: block;
}

/* =====================================================
   PAGE HEADER
   ===================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    margin: 0;
}

.page-header p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pos-caisse-header {
    background: linear-gradient(120deg, #ffffff 0%, #f8fafc 48%, #eef6ff 100%);
    border: 1px solid #dbe6f3;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.pos-caisse-header h1 {
    margin-bottom: 2px;
}

.pos-header-meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pos-metric-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #d5e2ef;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.pos-metric-pill i {
    color: #0f766e;
}

/* =====================================================
   FILTERS
   ===================================================== */
.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}

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

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.68) 0%, rgba(15, 23, 42, 0.58) 100%);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.modal {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-xl);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    transform: translateY(8px) scale(0.97);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.95);
    background: #ffffff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--gray-900);
    border-color: rgba(148, 163, 184, 0.95);
    background: #f8fafc;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer .btn {
    min-width: 108px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-toggle-text {
        display: none;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   UTILITIES
   ===================================================== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }

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

.d-flex { display: flex; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

.text-end { text-align: right; }
.text-center { text-align: center; }

.w-100 { width: 100%; }

/* Print styles */
@media print {
    .sidebar, .topbar, .page-actions, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
    }
    .content-wrapper {
        padding: 0;
    }
}

/* =====================================================
   TOAST NOTIFICATIONS - Animated confirmation system
===================================================== */
.toast-notification {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 340px;
    max-width: 480px;
    padding: 16px 18px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary);
    margin-bottom: 20px;
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.toast-notification.toast-hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

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

.toast-success { border-left-color: #10b981; }
.toast-danger { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-info { border-left-color: #3b82f6; }

.toast-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.toast-success .toast-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    animation: iconPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-danger .toast-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    animation: iconShake 0.5s ease-in-out;
}

.toast-warning .toast-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.toast-info .toast-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

@keyframes iconPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes iconShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 18px;
    line-height: 1;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress 4s linear forwards;
    transform-origin: left center;
}

.toast-success .toast-progress { background: #10b981; }
.toast-danger .toast-progress { background: #ef4444; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info .toast-progress { background: #3b82f6; }

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Conteneur toasts à droite */
#toastContainer .toast-notification {
    margin-bottom: 0;
}

/* Style premium pour les boutons de validation */
.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* Animation de succès pour formulaires */
@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.form-success-animation {
    animation: successPulse 1s ease-out;
}

/* =====================================================
   MOBILE RESPONSIVE LAYER
   ===================================================== */
html {
    -webkit-text-size-adjust: 100%;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

.table-wrapper,
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
    :root {
        --topbar-height: 60px;
    }

    body {
        font-size: 13px;
        overflow-x: hidden;
    }

    .app-container {
        display: block;
        min-width: 0;
    }

    .sidebar {
        width: min(86vw, 320px);
        max-width: 320px;
        z-index: 1000;
        box-shadow: 18px 0 40px rgba(15, 23, 42, 0.24);
    }

    .sidebar-brand {
        padding: 16px;
    }

    .sidebar-nav {
        padding: 10px;
    }

    .nav-section {
        margin-bottom: 12px;
    }

    .nav-item {
        min-height: 42px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .main-content {
        margin-left: 0 !important;
        min-width: 0;
    }

    .topbar {
        min-height: var(--topbar-height);
        height: auto;
        padding: 8px 12px;
        gap: 8px;
        align-items: center;
    }

    .topbar-left {
        min-width: 0;
        gap: 10px;
    }

    .breadcrumb {
        font-size: 16px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-date,
    .societe-selector,
    .depot-selector {
        font-size: 12px;
    }

    .content-wrapper {
        padding: 12px;
        min-width: 0;
    }

    .page-header {
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    .page-header > div,
    .page-actions {
        width: 100%;
        min-width: 0;
    }

    .page-header h1 {
        font-size: 21px;
        line-height: 1.2;
    }

    .page-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    }

    .page-actions .btn,
    .form-actions .btn,
    .filters-bar .btn {
        min-width: 0;
    }

    .stats-grid,
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card,
    .card {
        border-radius: 8px;
        margin-bottom: 14px;
    }

    .stat-card,
    .card-body {
        padding: 14px;
    }

    .card-header {
        padding: 12px 14px;
        gap: 8px;
        align-items: flex-start;
    }

    .card-title {
        font-size: 15px;
        min-width: 0;
    }

    .filters-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
        border-radius: 8px;
    }

    .filters-bar > *,
    .search-box,
    .form-group,
    .form-control,
    select.form-control,
    textarea.form-control {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

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

    .btn {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 13px;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
    }

    .btn-sm {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .table-wrapper,
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        border-radius: 8px;
    }

    .table {
        min-width: 760px;
    }

    .table thead th,
    .table tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .modal-overlay {
        padding: 8px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal,
    .modal-lg,
    .modal-xl {
        max-width: none;
        width: 100%;
        max-height: calc(100vh - 16px);
        border-radius: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 14px;
    }

    .modal-footer {
        display: grid;
        grid-template-columns: 1fr;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .toast-notification {
        min-width: 0;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 0 12px 10px;
    }

    .selector-dropdown {
        position: fixed;
        left: 12px;
        right: 12px;
        top: calc(var(--topbar-height) + 8px);
        min-width: 0;
        width: auto;
    }

    /* Pages module-specific: many screens use inline/grid utility names. */
    [class*="-hero"],
    [class*="-header"],
    [class*="-summary"],
    [class*="-panel"],
    [class*="-command"],
    [class*="-layout"],
    [class*="-form-layout"],
    [class*="-filters"],
    [class*="-filter-panel"],
    [class*="-advanced-grid"] {
        max-width: 100%;
    }

    [class*="-layout"],
    [class*="-form-layout"],
    [class*="-command"],
    [class*="-filters"],
    [class*="-filter-panel"],
    [class*="-advanced-grid"],
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    [class*="-kpi"],
    [class*="-kpis"],
    [class*="-stats"],
    [class*="-cards"],
    [class*="-board"],
    [class*="-list"],
    [class*="-strip"],
    [class*="-mini-grid"],
    [class*="-signal-grid"] {
        max-width: 100%;
    }

    [class*="-kpis"],
    [class*="-stats"],
    [class*="-cards"],
    [class*="-board"],
    [class*="-strip"],
    [class*="-mini-grid"],
    [class*="-signal-grid"] {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    }

    [class*="-actions"],
    [class*="-tools"],
    [class*="-controls"],
    [class*="-tabs"],
    [class*="-toolbar"],
    [class*="-pills"] {
        flex-wrap: wrap !important;
        max-width: 100%;
    }

    [class*="-actions"] > .btn,
    [class*="-tools"] > .btn,
    [class*="-controls"] > .btn,
    [class*="-toolbar"] > .btn,
    [class*="-tabs"] > a,
    [class*="-tabs"] > button {
        flex: 1 1 140px;
        min-width: 0;
    }

    form[style*="display:grid"],
    form[style*="display: grid"],
    div[style*="display:grid"],
    div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }

    div[style*="display:flex"],
    div[style*="display: flex"],
    form[style*="display:flex"],
    form[style*="display: flex"] {
        flex-wrap: wrap;
        max-width: 100%;
    }

    input[style*="width"],
    select[style*="width"],
    textarea[style*="width"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    .row,
    .grid,
    .layout,
    .dashboard-grid,
    .dashboard-row,
    .cards-grid,
    .kpi-grid,
    .form-grid {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }
}

@media (max-width: 560px) {
    .topbar {
        flex-wrap: wrap;
    }

    .topbar-left {
        width: 100%;
    }

    .topbar > div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .sidebar-toggle {
        width: 38px;
        height: 38px;
        flex: 0 0 auto;
    }

    .content-wrapper {
        padding: 10px;
    }

    .page-header h1 {
        font-size: 19px;
    }

    .stat-value {
        font-size: 23px;
        word-break: break-word;
    }

    .page-actions,
    .form-actions {
        grid-template-columns: 1fr;
    }

    .btn:not(.btn-icon) {
        width: 100%;
    }

    .card-header {
        display: grid;
        grid-template-columns: 1fr;
    }

    .table {
        min-width: 680px;
    }

    [class*="-kpis"],
    [class*="-stats"],
    [class*="-cards"],
    [class*="-board"],
    [class*="-mini-grid"],
    [class*="-signal-grid"] {
        grid-template-columns: 1fr !important;
    }

    [class*="-actions"] > .btn,
    [class*="-tools"] > .btn,
    [class*="-controls"] > .btn,
    [class*="-toolbar"] > .btn,
    [class*="-tabs"] > a,
    [class*="-tabs"] > button {
        flex-basis: 100%;
    }
}
