/* ==========================================================================
   IMPORT GOOGLE FONTS
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   1. VARIABLES & RESET GLOBAL
   ========================================================================== */
:root {
    --primary-color: #1EBCFF;
    --primary-dark: #0aa8eb;
    --secondary-color: #FFFFFF;
    --background-color: #F0F4F8;
    --surface-color: #FFFFFF;
    --text-color: #1a2332;
    --text-muted: #64748b;
    --nav-background: #1a2332;
    --nav-dropdown-bg: #243044;
    --nav-text-color: #FFFFFF;
    --input-border-color: #d1d9e0;
    --input-focus-color: #1EBCFF;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   2. EN-TÊTE & PIED DE PAGE
   ========================================================================== */
header {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 1em 0;
    text-align: center;
}

h1 {
    margin-bottom: 0.5em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

p {
    margin-bottom: 1em;
}

footer {
    background-color: var(--nav-background);
    color: var(--secondary-color);
    text-align: center;
    padding: 1em 0;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 10;
    font-size: 0.85em;
    opacity: 0.9;
}

/* ==========================================================================
   3. BARRE DE NAVIGATION (sans !important)
   ========================================================================== */
.navbar {
    background-color: var(--nav-background);
    height: 54px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 4px;
}

.navbar ul li {
    list-style: none;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.navbar .logo {
    display: flex;
    align-items: center;
    padding-right: 24px;
    height: 100%;
    background: none;
    margin-right: 8px;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.navbar .logo img {
    height: 36px;
    width: auto;
    display: block;
}

.dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.navbar a,
.dropbtn {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0 16px;
    height: 38px;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    letter-spacing: 0.01em;
}

.navbar a:hover,
.dropdown:hover .dropbtn {
    background-color: rgba(30, 188, 255, 0.15);
    color: var(--primary-color);
}

/* Liens directs hors dropdown */
.navbar > ul > a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0 16px;
    height: 38px;
    display: flex;
    align-items: center;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.navbar > ul > a:hover {
    background-color: rgba(30, 188, 255, 0.15);
    color: var(--primary-color);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--nav-dropdown-bg);
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    border-radius: 0 0 8px 8px;
    top: 54px;
    left: 0;
    padding: 6px;
    border-top: 2px solid var(--primary-color);
}

.dropdown:hover .dropdown-content {
    display: flex;
    flex-direction: column;
}

.dropdown-content a {
    color: rgba(255,255,255,0.85);
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 14px;
    font-size: 0.875em;
    font-weight: 400;
    border-radius: 5px;
    height: auto;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: none;
}

.dropdown-content a:hover {
    background-color: rgba(30, 188, 255, 0.15);
    color: var(--primary-color);
}

/* ==========================================================================
   4. FORMULAIRES — LAYOUT 2 COLONNES
   ========================================================================== */
.form-container {
    padding: 32px 24px 80px;
    max-width: 900px;
    margin: 0 auto;
}

form {
    background: var(--surface-color);
    padding: 36px 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.05);
}

form h1 {
    margin-bottom: 28px;
    font-size: 1.4em;
    color: var(--text-color);
    text-align: left;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--background-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

form h1::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Grille 2 colonnes */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
}

.form-grid .form-full {
    grid-column: 1 / -1;
}

form label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

form select,
form input[type="text"],
form input[type="password"],
form input[type="date"] {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 20px;
    border: 1.5px solid var(--input-border-color);
    border-radius: 7px;
    font-size: 0.95em;
    font-family: 'Inter', sans-serif;
    background: #fafbfc;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form select:focus,
form input[type="text"]:focus,
form input[type="password"]:focus,
form input[type="date"]:focus {
    border-color: var(--input-focus-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 188, 255, 0.12);
    background: #fff;
}

form input[type="submit"],
.btn-submit {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 11px 32px;
    font-size: 0.95em;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(30, 188, 255, 0.3);
    letter-spacing: 0.01em;
}

form input[type="submit"]:hover,
.btn-submit:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(30, 188, 255, 0.4);
    transform: translateY(-1px);
}

form input[type="submit"]:active,
.btn-submit:active {
    transform: translateY(0);
}

.filters select,
#societeFilter {
    margin: 8px 6px;
    padding: 8px 14px;
    border: 1.5px solid var(--input-border-color);
    border-radius: 7px;
    font-size: 0.9em;
    font-family: 'Inter', sans-serif;
    background: var(--surface-color);
    color: var(--text-color);
    min-width: 180px;
    transition: border-color 0.2s ease;
}

.filters select:focus,
#societeFilter:focus {
    border-color: var(--input-focus-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 188, 255, 0.12);
}

/* ==========================================================================
   5. ONGLETS
   ========================================================================== */
.table-container .tabs-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 28px 0 20px 0;
    padding: 0;
    list-style: none;
    height: 45px;
}

.table-container .tabs-nav .tab-btn {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border-radius: 7px;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease;
    background-color: var(--surface-color);
    color: var(--text-muted);
    border: 1.5px solid var(--input-border-color);
}

.table-container .tabs-nav .tab-btn:not(.active):hover {
    background-color: #f0f4f8;
    color: var(--text-color);
    border-color: #b0bec5;
}

.table-container .tabs-nav .tab-btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(30, 188, 255, 0.25);
}

/* ==========================================================================
   6. DASHBOARD (page d'accueil)
   ========================================================================== */
.dashboard {
    padding: 32px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--text-color);
    border: none;
    padding: 0;
    margin-bottom: 4px;
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 0.95em;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 12px 12px 0 0;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    font-size: 1.6em;
    line-height: 1;
}

.stat-card .stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.82em;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.dashboard-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

.dashboard-card h2 {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-card h2 .badge {
    background: var(--background-color);
    color: var(--text-muted);
    font-size: 0.78em;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.quick-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    background: var(--background-color);
    font-size: 0.875em;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
}

.quick-link:hover {
    background-color: rgba(30, 188, 255, 0.08);
    color: var(--primary-color);
    border-color: rgba(30, 188, 255, 0.2);
}

.quick-link .ql-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--background-color);
    font-size: 0.875em;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-dot.green { background: #22c55e; }
.activity-dot.red   { background: #ef4444; }
.activity-dot.blue  { background: var(--primary-color); }
.activity-dot.amber { background: #f59e0b; }

.activity-text {
    flex: 1;
    color: var(--text-color);
    line-height: 1.4;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.8em;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .quick-links { grid-template-columns: 1fr; }
}