/**
 * ZacAjouts — Styles partagés (dispatch + tech)
 * Thème sombre calqué sur admin_abat / iOS TechnicienTerrain
 */

:root {
    --bg-dark: #1a1a2e;
    --bg-darker: #16162a;
    --bg-card: #1f1f3a;
    --bg-card-hover: #252548;
    --bg-input: #2a2a4a;
    --bg-elevated: #2f2f55;

    --accent-red: #c41e3a;
    --accent-red-hover: #d42e4a;
    --accent-blue: #3b82f6;
    --accent-blue-soft: rgba(59, 130, 246, 0.15);
    --accent-green: #22c55e;
    --accent-green-soft: rgba(34, 197, 94, 0.15);
    --accent-yellow: #eab308;
    --accent-yellow-soft: rgba(234, 179, 8, 0.15);
    --accent-orange: #f59e0b;

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;

    --border-color: #2a2a4a;
    --border-light: #3a3a5a;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

*::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; }

html, body {
    height: 100%;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    color: inherit;
}

button { cursor: pointer; }

/* ================ Boutons ================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.btn:hover { background: var(--bg-elevated); }
.btn:active { transform: scale(0.98); }
.btn.btn-primary { background: var(--accent-red); border-color: var(--accent-red); }
.btn.btn-primary:hover { background: var(--accent-red-hover); border-color: var(--accent-red-hover); }
.btn.btn-blue { background: var(--accent-blue); border-color: var(--accent-blue); }
.btn.btn-ghost { background: transparent; }
.btn.btn-danger { background: transparent; color: var(--accent-red); border-color: rgba(196, 30, 58, 0.4); }
.btn.btn-danger:hover { background: rgba(196, 30, 58, 0.1); }
.btn.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-block { width: 100%; }

/* ================ Inputs ================ */
.input, .select, .textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 15px;
    transition: border-color 0.15s, background 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-elevated);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { min-height: 90px; resize: vertical; }
.label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ================ Badges ================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-secondary);
}
.badge-planned { background: var(--accent-blue-soft); color: var(--accent-blue); }
.badge-in-progress { background: var(--accent-yellow-soft); color: var(--accent-yellow); }
.badge-completed { background: var(--accent-green-soft); color: var(--accent-green); }
.badge-not-done { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.badge-cancelled { background: rgba(196, 30, 58, 0.12); color: var(--accent-red); }
.badge-cancelled-on-site { background: rgba(196, 30, 58, 0.2); color: #ff6b6b; }
.badge-tag { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); font-weight: 700; letter-spacing: 0.03em; }
.badge-bio {
    background: var(--accent-green);
    color: white;
    padding: 4px 14px;
    font-weight: 700;
}
.badge-soft {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 4px 12px;
}

/* ================ Cartes ================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
}

/* ================ Modal ================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 28, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    pointer-events: none;
}
.modal-backdrop.open {
    pointer-events: all;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}
.modal-close {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.modal-close:hover { background: var(--bg-input); color: var(--text-primary); }

/* ================ Toasts ================ */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}
.toast {
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    border-left: 3px solid var(--accent-blue);
    animation: slide-in 0.18s ease-out;
}
.toast-success { border-left-color: var(--accent-green); }
.toast-error { border-left-color: var(--accent-red); }
@keyframes slide-in {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ================ Utils ================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 18px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
