/* ============================================
   SYSTÈME BON DE LIVRAISON - STYLES
   ============================================ */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --bg: #f1f5f9;
    --white: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.navbar-nav a:hover, .navbar-nav a.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

/* ---- LAYOUT ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.page-content { padding: 28px 20px; }

/* ---- CARDS ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
}

.card-header h2 { font-size: 18px; font-weight: 600; }
.card-body { padding: 24px; }

/* ---- STATS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.stat-icon.blue  { background: #eff6ff; }
.stat-icon.green { background: #f0fdf4; }
.stat-icon.orange{ background: #fffbeb; }
.stat-icon.red   { background: #fef2f2; }

.stat-info h3 { font-size: 28px; font-weight: 700; }
.stat-info p  { font-size: 13px; color: var(--text-light); margin-top: 2px; }

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

table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: #b91c1c; }
.btn-outline {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: white;
    transition: border 0.2s;
    outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
select.form-control { appearance: none; }

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

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d4ed8 0%, #0891b2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .icon {
    font-size: 48px;
    display: block;
    margin-bottom: 8px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.login-logo p {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ---- SCAN PAGE ---- */
.scan-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.scan-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.scan-success { border-top: 5px solid var(--success); }
.scan-already { border-top: 5px solid var(--info); }
.scan-icon { font-size: 64px; margin-bottom: 16px; }

/* ---- QR CODE DISPLAY ---- */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed var(--border);
}

.qr-container img { border-radius: 8px; }
.qr-container p { font-size: 12px; color: var(--text-light); }

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

.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header p  { color: var(--text-light); font-size: 14px; margin-top: 2px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar-nav { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
