/* ============================================================
   ZARAN-T TrackColis Pro — Stylesheet
   Palette: Rouge #C41E3A, Bleu sombre #1a2744, Blanc #fff
   ============================================================ */

:root {
    --red: #C41E3A;
    --red-dark: #9e1530;
    --red-light: #f8e8eb;
    --blue: #1a2744;
    --blue-mid: #2c3e6b;
    --blue-light: #e8ecf5;
    --gold: #e8a020;
    --gray: #6b7280;
    --gray-light: #f3f4f6;
    --white: #ffffff;
    --border: #dde1ea;
    --shadow: 0 2px 12px rgba(26,39,68,.10);
    --shadow-lg: 0 8px 32px rgba(26,39,68,.15);
    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f2f8; color: #222; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- NAVBAR ---- */
.navbar {
    background: var(--blue);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    position: sticky; top: 0; z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.nav-logo-wrap {
    background: var(--white);
    border-radius: 8px;
    padding: 3px 8px;
    display: flex; align-items: center; justify-content: center;
    height: 44px;
}
.nav-logo { height: 36px; object-fit: contain; display: block; }
.nav-title { color: var(--white); font-size: 1rem; font-weight: 700; letter-spacing: .5px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
    color: rgba(255,255,255,.75);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    display: flex; align-items: center; gap: 6px;
    transition: all .2s;
}
.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,.15);
    color: var(--white);
}
.nav-links a.active { background: var(--red); }
.nav-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-badge {
    background: rgba(255,255,255,.12);
    color: var(--white);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.user-badge.admin { background: var(--red); }
.btn-logout {
    color: rgba(255,255,255,.7);
    font-size: 1.1rem;
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    transition: all .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.15); color: var(--white); }

/* ---- MAIN CONTENT ---- */
.main-content { flex: 1; padding: 28px 32px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--border);
}
.page-header h1 { font-size: 1.6rem; color: var(--blue); display: flex; align-items: center; gap: 10px; }
.page-header h1 i { color: var(--red); }

/* ---- ALERTS ---- */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: .9rem;
    font-weight: 500;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #059669; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--red); }
.alert-info    { background: var(--blue-light); color: var(--blue); border-left: 4px solid var(--blue); }
.alert-close { margin-left: auto; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* ---- CARDS ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    background: var(--blue);
    color: var(--white);
    padding: 14px 20px;
    font-size: .95rem;
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.card-header.red { background: var(--red); }
.card-body { padding: 22px; }

/* ---- STATS GRID ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    border-left: 4px solid var(--blue);
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.red   { border-color: var(--red); }
.stat-card.gold  { border-color: var(--gold); }
.stat-card.green { border-color: #059669; }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    background: var(--blue-light); color: var(--blue);
}
.stat-card.red  .stat-icon { background: var(--red-light); color: var(--red); }
.stat-card.gold .stat-icon { background: #fef3c7; color: var(--gold); }
.stat-card.green .stat-icon { background: #d1fae5; color: #059669; }
.stat-info h3 { font-size: 1.7rem; font-weight: 800; color: var(--blue); }
.stat-info p  { font-size: .8rem; color: var(--gray); font-weight: 500; }

/* ---- TABLES ---- */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--blue); color: var(--white); }
thead th { padding: 12px 16px; font-size: .82rem; font-weight: 600; text-align: left; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: var(--gray-light); }
tbody td { padding: 12px 16px; font-size: .875rem; vertical-align: middle; }

/* ---- BADGES ---- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
}
.badge-brouillon  { background: #f3f4f6; color: #374151; }
.badge-validé     { background: #dbeafe; color: #1d4ed8; }
.badge-expédié    { background: #fef3c7; color: #92400e; }
.badge-en_transit { background: #e0e7ff; color: #4338ca; }
.badge-livré      { background: #d1fae5; color: #065f46; }
.badge-annulé     { background: #fee2e2; color: #991b1b; }
.badge-admin      { background: var(--red-light); color: var(--red); }
.badge-agent      { background: var(--blue-light); color: var(--blue); }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all .2s;
}
.btn-primary   { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--blue); color: var(--white); }
.btn-secondary:hover { background: var(--blue-mid); }
.btn-outline   { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.btn-outline:hover { background: var(--blue); color: var(--white); }
.btn-sm        { padding: 5px 12px; font-size: .8rem; }
.btn-danger    { background: var(--red); color: var(--white); }
.btn-success   { background: #059669; color: var(--white); }
.btn-gold      { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: #c8870f; }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full   { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .8rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .3px; }
.form-group label span.req { color: var(--red); }
.form-control {
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    background: var(--white);
    color: #111;
    transition: border-color .2s;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(196,30,58,.1); }
.form-control[readonly] { background: var(--gray-light); color: var(--gray); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 01.753 1.659l-4.796 5.48a1 1 0 01-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 30px; }

/* Section dividers in forms */
.form-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.form-section-header {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
    color: var(--white);
    padding: 12px 20px;
    font-size: .85rem;
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-section-header.red { background: linear-gradient(135deg, var(--red) 0%, #9e1530 100%); }
.form-section-body { padding: 20px; }

/* ---- NIM BADGE ---- */
.nim-display {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    padding: 10px 24px;
    border-radius: var(--radius);
    display: inline-block;
    font-family: 'Courier New', monospace;
    box-shadow: var(--shadow);
}

/* ---- TRACKING TIMELINE ---- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
    position: absolute; left: -25px; top: 4px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--red);
}
.timeline-dot.green { background: #059669; box-shadow: 0 0 0 2px #059669; }
.timeline-dot.gold  { background: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.timeline-date { font-size: .75rem; color: var(--gray); margin-bottom: 4px; }
.timeline-content {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}
.timeline-content h4 { font-size: .9rem; color: var(--blue); font-weight: 700; }
.timeline-content p  { font-size: .82rem; color: var(--gray); margin-top: 4px; }

/* ---- SEARCH BAR ---- */
.search-bar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.search-input { flex: 1; min-width: 250px; }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 50%, #3d5296 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}
.login-header {
    background: var(--red);
    padding: 32px 28px;
    text-align: center;
}
.login-header img { height: 60px; filter: brightness(0) invert(1); margin-bottom: 10px; }
.login-header h1 { color: var(--white); font-size: 1.2rem; font-weight: 700; margin: 0; }
.login-header p  { color: rgba(255,255,255,.8); font-size: .85rem; margin-top: 4px; }
.login-body { padding: 28px; }
.login-body .form-group { margin-bottom: 18px; }

/* ---- FOOTER ---- */
.footer {
    background: var(--blue);
    color: rgba(255,255,255,.7);
    padding: 16px 32px;
    margin-top: auto;
}
.footer-content { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { height: 28px; filter: brightness(0) invert(1); }
.footer-brand p { font-size: .78rem; }
.footer-meta { display: flex; gap: 20px; font-size: .78rem; }
.footer-meta span { display: flex; align-items: center; gap: 5px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
    .nav-links { display: none; }
    .main-content { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- UTILS ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.w-100 { width: 100%; }

/* Dropdown actions */
.actions-cell { display: flex; gap: 5px; flex-wrap: wrap; }
