/* Gardien — sortie marchandise. RTL Arabic UI. Standalone styles. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --gd-red:         #c0392b;
    --gd-green-btn:   #1a7a3c;
    --gd-strip-red:   #F1948A;
    --gd-strip-green: #82E0AA;
    --gd-strip-blue:  #85C1E9;
    --gd-bg:          #f0f2f5;
    --gd-surface:     #ffffff;
    --gd-border:      #dde1e7;
    --gd-text:        #111827;
    --gd-muted:       #6b7280;
    --gd-radius:      14px;
}

body.gardien-app {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: var(--gd-bg);
    color: var(--gd-text);
    min-height: 100vh;
    direction: rtl;
}

.gd-topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--gd-surface); border-bottom: 1.5px solid var(--gd-border);
    padding: 12px 20px; display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
}
.gd-topbar h1 { font-size: 18px; font-weight: 800; white-space: nowrap; letter-spacing: -0.01em; }
.gd-topbar .gd-user { font-size: 13px; color: var(--gd-muted); margin-right: auto; }
.gd-topbar .gd-user a { color: var(--gd-red); text-decoration: none; margin-right: 10px; }

.gd-search {
    flex: 1; min-width: 220px; padding: 11px 16px;
    border: 1.5px solid var(--gd-border); border-radius: 10px;
    font-size: 15px; background: var(--gd-bg); color: var(--gd-text);
    direction: rtl; transition: border-color 0.15s;
}
.gd-search:focus { outline: none; border-color: var(--gd-red); }

.gd-sel-count { font-size: 14px; color: var(--gd-muted); white-space: nowrap; font-weight: 600; }

.gd-btn-submit {
    background: var(--gd-red); color: #fff; border: none;
    border-radius: 10px; padding: 12px 26px; font-size: 17px;
    font-weight: 800; cursor: pointer; white-space: nowrap;
    transition: opacity 0.15s, transform 0.1s;
}
.gd-btn-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.gd-btn-submit:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.gd-btn-refresh {
    background: var(--gd-green-btn); color: #fff; border: none;
    border-radius: 10px; padding: 12px 22px; font-size: 17px;
    font-weight: 800; cursor: pointer; white-space: nowrap;
    display: flex; align-items: center; gap: 8px;
    transition: opacity 0.15s, transform 0.1s;
}
.gd-btn-refresh.spinning .gd-refresh-icon { animation: gdspin 0.7s linear; }
@keyframes gdspin { from{transform:rotate(0deg);} to{transform:rotate(360deg);} }
.gd-refresh-icon { display: inline-block; font-size: 18px; line-height: 1; }
.gd-btn-refresh:hover { opacity: 0.9; transform: translateY(-1px); }

.gd-content { padding: 20px; }
.gd-loader { text-align: center; padding: 80px; color: var(--gd-muted); font-size: 16px; }

.gd-date-block { margin-bottom: 3rem; }
.gd-date-heading {
    font-size: 18px; font-weight: 800; color: var(--gd-text);
    margin-bottom: 16px; padding-bottom: 10px;
    border-bottom: 3px solid var(--gd-border);
    display: flex; align-items: center; gap: 12px;
}
.gd-today-badge {
    font-size: 12px; font-weight: 800; background: var(--gd-red);
    color: #fff; border-radius: 999px; padding: 4px 12px;
}

.gd-rotations {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 960px) { .gd-rotations { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .gd-rotations { grid-template-columns: 1fr; } }

.gd-rot-col {
    background: var(--gd-surface);
    border: 1.5px solid var(--gd-border);
    border-radius: var(--gd-radius);
    overflow: hidden;
    min-width: 0;
}
.gd-rot-header {
    padding: 13px 16px;
    font-size: 14px; font-weight: 800;
    border-bottom: 1.5px solid var(--gd-border);
    display: flex; align-items: center; gap: 10px;
    background: #f8f9fb;
}
.gd-rot-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.gd-rot-dot-r1   { background: #f39c12; box-shadow: 0 0 6px #f39c1288; }
.gd-rot-dot-r2   { background: #8e44ad; box-shadow: 0 0 6px #8e44ad88; }
.gd-rot-dot-sp   { background: #95a5a6; }

.gd-rot-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.gd-rot-empty { padding: 24px 10px; color: var(--gd-muted); font-size: 13px; text-align: center; }

.gd-card {
    background: #fdfdfd;
    border: 2px solid var(--gd-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    position: relative;
    user-select: none;
    width: 100%;
    min-height: 200px;
    display: flex; flex-direction: column;
}
.gd-card:hover { border-color: #aaa; transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.gd-card.selected { border-color: var(--gd-red); background: #fff8f8; box-shadow: 0 0 0 3px #c0392b22; }
.gd-card.selected::after {
    content: '✓'; position: absolute; top: 9px; left: 9px;
    background: var(--gd-red); color: #fff; border-radius: 50%;
    width: 24px; height: 24px;
    font-size: 13px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
}

.gd-strip { height: 6px; flex-shrink: 0; }
.gd-strip-red   { background: var(--gd-strip-red); }
.gd-strip-green { background: var(--gd-strip-green); }
.gd-strip-blue  { background: var(--gd-strip-blue); }
.gd-strip-gray  { background: #d1d5db; }

.gd-badges {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 10px 12px 0;
}
.gd-badge-truck {
    border-radius: 999px; font-size: 12px; font-weight: 700;
    padding: 4px 12px; background: #1e3a5f; color: #fff;
}
.gd-badge-groupe {
    border-radius: 999px; font-size: 12px; font-weight: 700;
    padding: 4px 12px;
    background: #dcfce7; color: #166534;
    border: 1px solid #bbf7d0;
}

.gd-card-body { padding: 10px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.gd-card-code    { font-size: 17px; font-weight: 800; color: var(--gd-text); }
.gd-card-client  { font-size: 13px; color: var(--gd-muted); font-weight: 500; }
.gd-card-articles{ font-size: 12px; color: var(--gd-muted); line-height: 1.6; flex: 1; }
.gd-card-total   { font-size: 15px; font-weight: 800; color: var(--gd-text); }
.gd-card-driver  {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-size: 12px; color: var(--gd-muted); font-weight: 500;
    border-top: 1px solid var(--gd-border); padding-top: 8px; margin-top: 4px;
}

.gd-modal-bd {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); z-index: 200;
    align-items: center; justify-content: center;
}
.gd-modal-bd.open { display: flex; }
.gd-modal {
    background: var(--gd-surface); border-radius: var(--gd-radius);
    padding: 28px; width: 92%; max-width: 560px; max-height: 88vh;
    overflow-y: auto; position: relative; direction: rtl;
}
.gd-modal h2 { font-size: 18px; font-weight: 800; margin-bottom: 18px; }
.gd-modal-close {
    position: absolute; top: 16px; left: 16px;
    background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gd-muted);
}
.gd-preview-card {
    border: 1.5px solid var(--gd-border); border-radius: 12px;
    padding: 14px 16px; margin-bottom: 12px;
}
.gd-preview-card h3 { font-size: 15px; font-weight: 800; margin-bottom: 5px; }
.gd-preview-card p  { font-size: 13px; color: var(--gd-muted); margin: 3px 0; line-height: 1.6; }
.gd-warning {
    background: #fef2f2; border: 2px solid #f5c6c6; border-radius: 12px;
    padding: 18px 22px; margin: 16px 0;
    font-size: 20px; font-weight: 700;
    color: var(--gd-red); text-align: right; line-height: 1.5;
    box-shadow: 0 4px 12px rgba(192, 57, 43, .12);
}
.gd-modal-actions { display: flex; gap: 12px; justify-content: flex-start; margin-top: 18px; }
.gd-btn-cancel {
    background: none; border: 1.5px solid var(--gd-border);
    border-radius: 10px; padding: 10px 22px; font-size: 15px; cursor: pointer; font-weight: 600;
}
.gd-btn-confirm {
    background: var(--gd-red); color: #fff; border: none;
    border-radius: 10px; padding: 10px 24px; font-size: 15px; font-weight: 800; cursor: pointer;
}
.gd-btn-confirm:disabled { opacity: 0.4; cursor: not-allowed; }
.gd-success {
    text-align: center; padding: 28px;
    color: #1a7a3c; font-size: 17px; font-weight: 800;
    line-height: 2;
}

.gd-matricule-confirm {
    background: #f8f9fb;
    border: 1.5px solid var(--gd-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 14px;
}
.gd-matricule-confirm label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gd-text);
    margin-bottom: 8px;
}
.gd-matricule-confirm input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gd-border);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 1.5px;
    text-align: center;
    background: #fff;
    outline: none;
    direction: ltr;
    transition: border-color 0.15s;
}
.gd-matricule-confirm input:focus { border-color: var(--gd-red); }

.gd-splash {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 65vh; gap: 14px; padding: 20px;
    text-align: center;
}
.gd-splash-icon { font-size: 64px; line-height: 1; }
.gd-splash-title { font-size: 22px; font-weight: 800; color: var(--gd-text); }
.gd-splash-sub { font-size: 15px; color: var(--gd-muted); }
