/* Optimisé — Conserve toutes les classes/IDs existants et le comportement visuel.
   Regroupement, dédoublonnage et variables pour maintenance. */

/* =========================
   Variables globales
   ========================= */
:root {
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --text: #333;
    --muted: #6c757d;
    --brand: #007bff;
    --brand-dark: #0056b3;
    --danger: #dc3545;
    --success: #28a745;
    --warn: #ffc107;
    --border: #e9ecef;
    --shadow-1: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --container-max: 1400px;
    --content-max: 1200px;
    --pad-base: 10px;
    --font-base: 1em;
}

/* =========================
   Reset / Global
   ========================= */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Arial', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 95%;
    max-width: var(--container-max);
    margin: 20px auto;
}

h1, h2, h3, h4 {
    color: #1a1a1a;
    margin-top: 0;
}

/* =========================
   Utilities / Shared
   ========================= */
.card,
.modal-content,
.login-container,
.module-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}

button,
.button,
.logout-btn {
    background: var(--brand);
    color: #fff;
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color .25s, box-shadow .25s, transform .15s;
    font-size: var(--font-base);
}

/* Button variants */
.button.secondary {
    background: #6c757d;
}
.button.secondary:hover {
    background: #5a6268;
}

button:hover,
.button:hover {
    background: var(--brand-dark);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Link-like table buttons */
#devis-table button {
    background: none;
    color: var(--brand);
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    font-size: var(--font-base);
}
#devis-table button:hover {
    color: var(--brand-dark);
    background: none;
    box-shadow: none;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
input[type="password"],
input[type="date"],
input[type="time"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: var(--font-base);
    background: #fff;
}

/* Compact inputs used in filter-controls (prevent margin-bottom collapse) */
.filter-controls.minimal-filters input,
.filter-controls.minimal-filters select {
    margin-bottom: 0;
}

/* Status badges / indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-wait { background: var(--warn); }
.status-ok   { background: var(--success); }
.status-fail { background: var(--danger); }

.status-pending {
    background-color: var(--warn);
    color: #343a40;
    padding: 4px 8px;
    border-radius: 4px;
}
.status-paid,
.status-confirmé,
.status-à_produire {
    background-color: var(--success);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
}

/* =========================
   Header & Navigation
   ========================= */
.app-header,
.dashboard-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 40px;
    background: var(--card-bg);
    border-bottom: 3px solid var(--brand);
    box-shadow: var(--shadow-2);
    margin-bottom: 25px;
    position: relative;
    z-index: 100;
}

/* Dashboard-specific fixed header adjustments */
.dashboard-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 30px;
    border-bottom-color: var(--brand);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Logo and header areas */
.logo-container,
.header-info-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 55px;
    width: auto;
}

.logo-container h1 {
    font-size: 1.5em;
    color: var(--brand-dark);
    margin: 0;
    font-weight: 700;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 30px;
    font-size: 1em;
}

.welcome-message {
    color: #333;
    font-weight: 700;
}

.datetime-info {
    color: #555;
    margin-left: 5px;
}

/* Logout button (unifié) */
.logout-btn {
    background: var(--danger);
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color .3s;
}
.logout-btn:hover {
    background: #c82333;
}

/* Dashboard logo with hover */
.dashboard-logo {
    width: 45px;
    height: 45px;
    margin-right: 15px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
    transition: all .3s ease;
}
.dashboard-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.3);
}

/* =========================
   Cards, Forms, Modals
   ========================= */
.card {
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    padding: 30px;
    width: 90%;
    max-width: 550px;
    animation: fadeIn .3s ease-out;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-close-button {
    cursor: pointer;
    font-size: 30px;
    color: #aaa;
    transition: color .3s;
}
.modal-close-button:hover {
    color: #333;
}

.modal-body ul {
    list-style: none;
    padding: 0;
}
.modal-body li {
    padding: 5px 0;
    border-bottom: 1px dotted #eee;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================
   Devis Table
   ========================= */
#devis-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#devis-table th,
#devis-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#devis-table th {
    background: #e9ecef;
    color: #495057;
    font-weight: 700;
}

#devis-table tr:hover {
    background: #f1f1f1;
}

/* Ligne sélectionnée (impression de devis) */
#devis-table .selected-row {
    background-color: #d1ecf1 !important;
    border: 2px solid var(--brand-dark);
    font-weight: 700;
}

/* =========================
   Primary Controls (70/30) + Search
   ========================= */
.primary-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.primary-controls .large-button {
    flex-basis: 70%;
    flex-grow: 0;
    font-size: 1.1em;
    padding: 12px 18px;
}

.search-group {
    flex-basis: 30%;
    flex-grow: 1;
    display: flex;
    gap: 0;
    align-items: center;
}

.search-group #search-input {
    flex-grow: 1;
    margin-bottom: 0;
    height: 44px;
    border-radius: 5px 0 0 5px;
    border-right: none;
}

.search-group #btn-search {
    height: 44px;
    padding: 0 10px;
    border-radius: 0 5px 5px 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Force le bouton principal à 100% de son conteneur */
.start-new-quote-area #btn-start-new-quote {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
}

/* =========================
   Filtres compacts (nouveau)
   ========================= */
.filter-controls.minimal-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid var(--border);
    font-size: 0.9em;
    overflow-x: auto;
}

.filter-controls.minimal-filters label {
    font-weight: 700;
    color: var(--brand-dark);
    white-space: nowrap;
    margin-right: 0;
}

.filter-controls.minimal-filters input[type="date"],
.filter-controls.minimal-filters input[type="time"],
.filter-controls.minimal-filters select {
    flex: 0 0 auto;
    width: auto;
    min-width: 80px;
    padding: 5px;
    height: 30px;
    font-size: 0.9em;
    margin-bottom: 0;
}

.filter-controls.minimal-filters select {
    min-width: 120px;
}

.filter-controls.minimal-filters button {
    height: 30px;
    padding: 0 10px;
    font-size: 0.9em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* =========================
   Login / Register Pages
   ========================= */
.login-body {
    background: #e9ecef;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.login-container {
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 25px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 1.8em;
    color: #343a40;
    margin: 5px 0 2px 0;
}

.login-header h2 {
    font-size: 1em;
    color: #6c757d;
    font-weight: 400;
    margin: 0;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 15px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 700;
    color: #495057;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 10px;
    font-size: 1em;
}

/* Login button full-width */
.login-button {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    margin-top: 20px;
}

/* Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: left;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: left;
}

/* Registration link */
.registration-link {
    margin-top: 15px;
    font-size: 0.9em;
    color: #6c757d;
}
.registration-link a {
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 700;
}
.registration-link a:hover {
    text-decoration: underline;
}

/* =========================
   Dashboard / Main Layout
   ========================= */
.dashboard-body {
    background: #f8f9fa;
    font-family: 'Arial', sans-serif;
    padding-top: 80px;
    color: #343a40;
}

.dashboard-container {
    max-width: var(--content-max);
    margin: 30px auto;
    padding: 0 20px;
}

.dashboard-container h2 {
    font-size: 1.8em;
    color: #343a40;
    margin-bottom: 25px;
    border-bottom: 2px solid #ced4da;
    padding-bottom: 10px;
}

/* Module grid */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.module-card {
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #343a40;
    transition: transform .3s, box-shadow .3s;
    border: 1px solid var(--border);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}
.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
.module-card i {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: block;
}
.module-card h3 {
    font-size: 1.2em;
    margin: 5px 0;
}
.module-card p {
    font-size: 0.9em;
    color: var(--muted);
}

/* Role accents */
.card-admin i    { color: var(--brand-dark); }
.card-magasin i  { color: var(--success); }
.card-caisse i   { color: var(--warn); }
.card-vendeur i  { color: #17a2b8; }
.card-production i { color: #6f42c1; }
.card-control i  { color: #fd7e14; }
.card-comptable i { color: var(--muted); }

/* =========================
   Secondary layout controls, reports
   ========================= */
.main-controls-container {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.start-new-quote-area {
    flex: 7;
}

.quick-search-area {
    flex: 3;
    display: flex;
    gap: 5px;
}
.quick-search-area input {
    flex-grow: 1;
}

.secondary-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.compact-line-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    flex: 1;
    margin-right: 20px;
}

.report-buttons,
.report-buttons-top {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.report-buttons-top {
    margin-bottom: 15px;
}

/* =========================
   Register: Roles
   ========================= */
.register-container {
    max-width: 550px;
}

.roles-fieldset {
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
}

.roles-fieldset legend {
    font-size: 1.1em;
    font-weight: 700;
    color: #495057;
    padding: 0 10px;
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.role-checkbox {
    display: flex;
    align-items: center;
    font-weight: 400;
    color: #343a40;
    cursor: pointer;
}
.role-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
}

/* =========================
   Accessibility / Misc
   ========================= */
:focus {
    outline: 3px solid rgba(0, 123, 255, 0.25);
    outline-offset: 2px;
}

/* End of optimized file */
/* =========================================
   HEADER DESIGN (GLOBAL)
   ========================================= */
:root {
    --header-height: 70px;
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --bg-light: #ffffff;
    --text-grey: #636e72;
    --border-color: #f1f2f6;
    --shadow-soft: 0 2px 15px rgba(0, 0, 0, 0.04);
}

body {
    padding-top: var(--header-height); /* Pour ne pas cacher le contenu sous le header fixe */
}

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: var(--shadow-soft);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-sizing: border-box;
}

/* --- ZONE GAUCHE --- */
.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 200px;
}

.logo-container {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    color: var(--accent-color);
    font-size: 1.4rem;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-grey);
    cursor: pointer;
    padding: 5px;
    transition: 0.2s;
}

.menu-toggle:hover { color: var(--primary-color); }

/* --- ZONE CENTRALE (Recherche) --- */
.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 600px;
}

.search-bar {
    position: relative;
    width: 100%;
    max-width: 450px;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: 50px; /* Effet pilule moderne */
    border: 1px solid #e1e1e1;
    background: #f8f9fa;
    color: #333;
    outline: none;
    transition: 0.3s;
}

.search-bar input:focus {
    background: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 0.9rem;
}

/* --- ZONE DROITE --- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

/* Bouton Retour Admin Spécial */
.btn-admin-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eef2f7;
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: 0.2s;
    border: 1px solid #dde1e6;
}

.btn-admin-nav:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.nav-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-grey);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.nav-link:hover { color: var(--primary-color); }

.text-primary { color: var(--accent-color); }

/* Notification Bell */
.notification-bell {
    position: relative;
    font-size: 1.2rem;
    transition: 0.2s;
}

.notification-bell:hover { color: var(--primary-color); transform: scale(1.1); }

.badge-count {
    position: absolute;
    top: -5px;
    right: -6px;
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* Profil Utilisateur */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 15px;
    border-left: 1px solid #eee;
}

.avatar-circle {
    width: 35px;
    height: 35px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.arrow-icon {
    font-size: 0.7rem;
    margin-left: 3px;
    color: #aaa;
}

/* Dropdown Menu simple au survol (Optionnel) */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px;
    width: 150px;
    margin-top: 10px;
}

.user-profile:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
}

.dropdown-menu a:hover {
    background: #f4f6f9;
}