/* ============================================================
   FEUILLE DE STYLE COMMUNE - LOGICIEL & SAAS
   ============================================================ */

/* ---- RESET & FONTS ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface2: #eef1f8;
    --border: #d4d9e8;
    --accent: #4a6ef5;
    --accent2: #8b5cf6;
    --green: #059669;
    --red: #dc2626;
    --yellow: #d97706;
    --text: #1e2235;
    --muted: #6b7280;
    --radius: 10px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- LAYOUT & CONTAINERS ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
	color: #0f1117;
}

header h1 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 22px;
}

.header-meta {
    font-size: 12px;
    color: var(--muted);
}

/* ---- NAVIGATION & TABS ---- */
.nav-links {
    display: flex;
    gap: 8px;
}

.nav-btn, .tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: all .15s;
}

.nav-btn:hover, .tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active, .tab-btn.active {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--accent);
}

.tab-bar {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    padding-bottom: 8px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ---- CARDS & GRIDS ---- */
.card, .form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card h2, .form-card h2 {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 18px;
}

/* Grille générique SaaS */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* ---- INPUTS & FORMS ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 9px 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    transition: border-color .2s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    margin-bottom: 14px;
}

/* Case à cocher customisée simple */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .18s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #476eff; }

.btn-success { background: rgba(52,211,153,0.15); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.btn-success:hover { background: rgba(52,211,153,0.25); }

.btn-warning { background: rgba(251,191,36,0.15); color: var(--yellow); border: 1px solid rgba(251,191,36,0.3); }
.btn-warning:hover { background: rgba(251,191,36,0.25); }

.btn-danger { background: rgba(248,113,113,0.15); color: var(--red); border: 1px solid rgba(248,113,113,0.3); }
.btn-danger:hover { background: rgba(248,113,113,0.25); }

.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.03); }

.btn-xs { padding: 5px 10px; font-size: 11px; border-radius: 4px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- TABLES ---- */
.table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto; /* Garantit le responsive sur mobile */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

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

thead th {
    background: var(--surface2);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}

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

tbody tr:hover {
    background: rgba(74, 110, 245, 0.04);
}

td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 13px;
}

/* ---- BADGES & ALERTS ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-bureau { background: rgba(167,139,250,.15); color: var(--accent2); }
.badge-benevole { background: rgba(91,127,255,.1); color: var(--accent); }
.badge-origine { background: rgba(251,191,36,.08); color: var(--yellow); }
.badge-info { background: rgba(255,255,255,0.07); color: var(--text); }

/* Statuts de sondages */
.badge-brouillon { background: rgba(251,191,36,0.12); color: var(--yellow); }
.badge-actif { background: rgba(52,211,153,0.12); color: var(--green); }
.badge-ferme { background: rgba(248,113,113,0.12); color: var(--red); }

.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert.success { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); color: var(--green); }
.alert.error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3); color: var(--red); }

/* ---- MODALS (OVERLAY + WINDOW) ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30,34,53,0.45);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 540px;
    padding: 24px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.2s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal h3 {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- STATE UTIL-CLASSES ---- */
.empty {
    text-align: center;
    padding: 32px;
    color: var(--muted);
    font-style: italic;
}

#toast {
    position: fixed;
    bottom: 20px; right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
    animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-item.success { border-left: 3px solid var(--green); }
.toast-item.error { border-left: 3px solid var(--red); }

@keyframes slideIn {
    from { transform: translateX(60px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ---- SPECIAL SaaS EXTENSIONS ---- */
/* Textarea SMS Wrapper */
.sms-wrap { position: relative; }
#smsMessage { min-height: 120px; resize: vertical; border-radius: 6px 6px 0 0; padding-bottom: 36px; }
.sms-counter {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 6px 12px;
    font-size: 11px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
}