/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 400;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: var(--bg-white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-login:hover {
    background: var(--secondary-color);
}

.error-message {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fee2e2;
    color: var(--danger-color);
    border-radius: 8px;
    text-align: center;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Admin Page */
body {
    overflow-x: auto;
    overflow-y: auto;
}

.admin-page {
    background: var(--bg-light);
    min-height: 100vh;
    transform: scale(0.7);
    transform-origin: top left;
    width: 142.857vw;
    height: 142.857vh;
}

/* Désactiver le zoom sur mobile et tablette */
@media (max-width: 1024px) {
    .admin-page {
        transform: none;
        width: 100%;
        height: auto;
    }
}

/* Admin Header */
.admin-header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-content {
    max-width: 100%;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: var(--primary-color);
    color: var(--bg-white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
    }
}
    justify-content: space-between;
    align-items: center;
}

.admin-logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-user span {
    color: var(--text-light);
    font-size: 0.9rem;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: var(--bg-white);
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
}

/* Admin Main Layout */
.admin-main {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* Sidebar */
.admin-sidebar {
    width: 250px;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    padding: 1.5rem 0;
}

.admin-nav {
    display: flex;
    flex-direction: column;
}

.nav-category {
    margin-top: 0.5rem;
}

.nav-category-title {
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.nav-category:first-child .nav-category-title {
    margin-top: 0;
}

.nav-category-items {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.2rem;
}

/* Admin Content */
.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-x: auto;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--text-dark);
}

.btn-add {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--bg-white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Planning Section */
.planning-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-control {
    padding: 0.5rem 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-control:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.week-display,
.month-display {
    font-weight: 600;
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
}

.planning-container {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Available Items */
.available-items {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.items-column {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.items-column h3 {
    font-size: 1rem;
    margin-bottom: 0;
    color: var(--text-dark);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    margin: -1rem -1rem 0 -1rem;
}

.items-column h3:hover {
    background-color: var(--bg-light);
}

.items-column h3::after {
    content: '▶';
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    color: var(--text-light);
}

.items-column:not(.collapsed) h3::after {
    transform: rotate(90deg);
}

.items-column.collapsed .draggable-list {
    display: none;
}

.draggable-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100px;
}

.draggable-item {
    padding: 0.75rem;
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.draggable-item:hover {
    background: #eff6ff;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.draggable-item.selected {
    background: var(--primary-color);
    color: var(--bg-white);
    border: 2px solid var(--primary-color);
    border-style: solid;
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* Types de matériel dans planning externe - police plus petite */
#materiel-types-list-externe-col1 .draggable-item,
#materiel-types-list-externe-col2 .draggable-item {
    font-size: 0.85rem;
    padding: 0.5rem;
}

/* Calendar Grid */
.calendar-grid {
    flex: 1;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: crosshair; /* Curseur de précision sur toute la grille */
}

.calendar-header {
    display: flex;
    background: var(--primary-color);
    color: var(--bg-white);
}

.days-header {
    display: flex;
    width: 100%;
}

.day-header {
    flex: 1;
    padding: 1rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.day-header:last-child {
    border-right: none;
}

.day-name {
    font-weight: 600;
}

.calendar-body {
    display: block;
}

.calendar-cells {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    width: 100%;
}

.calendar-cell {
    min-height: 250px;
    height: auto;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem;
    position: relative;
    transition: background 0.2s ease;
    background: var(--bg-white);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 400px;
    cursor: crosshair; /* Curseur de précision */
}

.calendar-cell::-webkit-scrollbar {
    width: 4px;
}

.calendar-cell::-webkit-scrollbar-track {
    background: transparent;
}

.calendar-cell::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.calendar-cell::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.calendar-cell.empty-cell {
    background: var(--bg-light);
    cursor: crosshair; /* Curseur de précision même pour les cellules vides */
}

.calendar-cell.today {
    background: #eff6ff;
    border: 2px solid var(--primary-color);
}

.day-number {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.calendar-cell.today .day-number {
    color: var(--primary-color);
    font-weight: 700;
}

.bookings-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow-y: auto;
    min-height: 0;
    position: relative;
}

.bookings-container-top {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: space-between;
    align-content: flex-start;
    align-items: flex-start;
    flex-shrink: 0;
}

.bookings-container-bottom {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: space-between;
    align-content: flex-end;
    align-items: flex-end;
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
}

.calendar-cell:hover {
    background: var(--bg-light);
}

.calendar-cell.drag-over {
    background: #dbeafe;
    border: 2px dashed var(--primary-color);
}

.calendar-cell.clickable {
    cursor: pointer;
}

.calendar-cell.clickable:hover {
    background: #dbeafe;
    border: 2px dashed var(--primary-color);
}

/* Booking Items */
.booking-item {
    background: var(--primary-color);
    color: var(--bg-white);
    border-radius: 6px;
    padding: 0.4rem;
    margin-bottom: 0;
    font-size: 0.75rem;
    box-shadow: var(--shadow);
    cursor: crosshair; /* Curseur de précision */
    flex-shrink: 0;
    min-height: auto;
    border: 2px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: calc(50% - 0.15rem);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Bulles CONGE PAYER : positionnées en bas à droite */
.bookings-container-bottom .booking-item.booking-conge-payer {
    margin-left: auto;
}

/* Bulles DEPOT : positionnées en bas à gauche */
.bookings-container-bottom .booking-item.booking-depot {
    margin-right: auto;
}

/* Bulles Transfert : style violet */
.booking-item.transfert-item {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.booking-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.booking-item.factured {
    opacity: 0.7;
    position: relative;
}

.booking-item.bon-signe {
    border: 4px solid #000000 !important; /* Bordure noire épaisse */
    opacity: 1;
}

.booking-bon-signe {
    font-size: 0.6rem;
    font-weight: 600;
    color: #10b981; /* Vert */
    margin-top: 0.25rem;
}

.booking-item.factured::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0, 0, 0, 0.1) 10px,
        rgba(0, 0, 0, 0.1) 20px
    );
    pointer-events: none;
    border-radius: 6px;
}

.booking-item.sous-traitance {
    position: relative;
}

.booking-item.sous-traitance::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        var(--stripe-color, #667eea),
        var(--stripe-color, #667eea) 8px,
        rgba(0, 0, 0, 0.5) 8px,
        rgba(0, 0, 0, 0.5) 16px
    );
    pointer-events: none;
    border-radius: 6px;
    opacity: 0.5;
    z-index: 0;
}

.booking-item.sous-traitance .booking-content {
    position: relative;
    z-index: 1;
}

.booking-factured {
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 0.25rem;
    opacity: 0.9;
}

.booking-item.factured {
    opacity: 0.7;
    position: relative;
}

.booking-item.factured::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0, 0, 0, 0.1) 10px,
        rgba(0, 0, 0, 0.1) 20px
    );
    pointer-events: none;
    border-radius: 6px;
}

.booking-factured {
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 0.25rem;
    opacity: 0.9;
}


.booking-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.booking-content > div {
    font-size: 0.65rem;
    opacity: 1;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background: var(--bg-white);
    margin: 2% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    min-height: 60vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-dark);
}

/* Management Content */
.management-content {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
    font-size: 1.1rem;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table thead {
    background: var(--primary-color);
    color: var(--bg-white);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-edit,
.btn-tarif,
.btn-delete,
.btn-chauffeur-hist,
.btn-entretien,
.btn-carburant,
.btn-vehicule,
.btn-accident,
.btn-reference {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-edit {
    background: var(--primary-color);
    color: var(--bg-white);
}

.btn-edit:hover {
    background: var(--secondary-color);
}

.btn-tarif {
    background: #10b981;
    color: var(--bg-white);
}

.btn-tarif:hover {
    background: #059669;
}

.btn-entretien {
    background: var(--accent-color);
    color: var(--bg-white);
}

.btn-entretien:hover {
    background: #d97706;
}

.btn-carburant {
    background: #ec4899;
    color: var(--bg-white);
}

.btn-carburant:hover {
    background: #db2777;
}

.btn-delete {
    background: var(--danger-color);
    color: var(--bg-white);
}

.btn-delete:hover {
    background: #dc2626;
}

.btn-chauffeur-hist {
    background: #10b981;
    color: var(--bg-white);
}

.btn-chauffeur-hist:hover {
    background: #059669;
}

.btn-vehicule {
    background: var(--accent-color);
    color: var(--bg-white);
}

.btn-vehicule:hover {
    background: #d97706;
}

.btn-accident {
    background: #8b5cf6;
    color: var(--bg-white);
}

.btn-accident:hover {
    background: #7c3aed;
}

.btn-reference {
    background: #000000;
    color: var(--bg-white);
}

.btn-reference:hover {
    background: #333333;
}

.btn-delete-small {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: var(--danger-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-delete-small:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Materiel Form */
.materiel-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.materiel-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.materiel-form label {
    font-weight: 600;
    color: var(--text-dark);
}

.materiel-form input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.materiel-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--bg-white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--text-light);
    color: var(--bg-white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #4b5563;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-cancel,
.btn-submit {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--border-color);
}

.btn-submit {
    background: var(--primary-color);
    color: var(--bg-white);
}

.btn-submit:hover {
    background: var(--secondary-color);
}

/* Entretien Styles */
.entretien-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.entretien-form-section,
.entretien-history-section {
    display: flex;
    flex-direction: column;
}

.entretien-history-section h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.entretien-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.entretien-item {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid var(--accent-color);
}

.entretien-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.entretien-date {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.entretien-type {
    background: var(--accent-color);
    color: var(--bg-white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.entretien-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.entretien-kilometrage {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.materiel-form select,
.materiel-form textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
    width: 100%;
}

.materiel-form select:focus,
.materiel-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.materiel-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.checkbox-label:hover {
    background: var(--bg-light);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    font-size: 1rem;
    color: var(--text-dark);
}

/* Color Picker */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-picker-container input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.color-preset {
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--text-dark);
}

.color-preset.active {
    border-color: var(--primary-color);
    border-width: 3px;
    box-shadow: 0 0 0 2px var(--bg-white), 0 0 0 4px var(--primary-color);
}

.color-display {
    display: inline-block;
}

/* Context Menu */
.context-menu {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 150px;
    border: 1px solid var(--border-color);
}

.context-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.context-menu-item:hover {
    background: var(--bg-light);
}

.context-menu-item.delete {
    color: var(--danger-color);
    border-top: 1px solid var(--border-color);
}

.context-menu-item.delete:hover {
    background: #fee2e2;
}

.context-menu-item.delete.disabled {
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.5;
}

.context-menu-item.delete.disabled:hover {
    background: transparent;
}

/* Bon Styles */
.bon-info {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.bon-info p {
    margin: 0.75rem 0;
    font-size: 1rem;
}

.bon-links {
    margin-top: 2rem;
}

.bon-link-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.bon-link-section h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.link-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.link-container input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.btn-copy {
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-copy:hover {
    background: var(--secondary-color);
}

.btn-regenerate {
    padding: 0.75rem 1rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-regenerate:hover {
    background: var(--primary-color);
    opacity: 0.9;
}

.signed {
    color: var(--success-color);
    font-weight: 600;
    margin-top: 0.5rem;
}

.unsigned {
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .entretien-container {
        grid-template-columns: 1fr;
    }
    
    .actions-cell {
        flex-direction: column;
    }
    
    .btn-edit,
    .btn-tarif,
    .btn-entretien,
    .btn-delete,
    .btn-chauffeur-hist,
    .btn-reference {
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .planning-container {
        flex-direction: column;
    }

    .available-items {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }

    .items-column {
        min-width: 200px;
    }
}

/* Menu hamburger et sidebar mobile */
@media (max-width: 1024px) {
    .admin-sidebar {
        position: fixed;
        left: -250px;
        top: 70px;
        height: calc(100vh - 70px);
        width: 250px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .admin-sidebar.open {
        left: 0;
    }

    .admin-nav {
        flex-direction: column;
        overflow-y: auto;
        height: 100%;
    }

    .nav-item {
        border-left: 3px solid transparent;
        border-bottom: none;
    }

    .nav-item.active {
        border-left-color: var(--primary-color);
        border-bottom: none;
    }

    .admin-content {
        width: 100%;
        padding: 1rem;
    }

    .admin-logo h1 {
        font-size: 1.2rem;
    }

    .admin-user {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .admin-user span {
        font-size: 0.8rem;
    }

    .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .admin-main {
        flex-direction: column;
    }

    .admin-header-content {
        padding: 0.75rem 1rem;
    }

    .admin-logo h1 {
        font-size: 1rem;
    }

    .admin-content {
        padding: 0.75rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }

    .planning-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Tableaux scrollables */
    /* Tables de gestion - Mode carte pour mobile portrait */
    .data-table {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: block;
        width: 100%;
    }

    .data-table tr {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1rem;
        background: var(--bg-white);
        box-shadow: var(--shadow);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--bg-light);
        font-size: 0.9rem;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-dark);
        margin-right: 1rem;
        min-width: 120px;
        flex-shrink: 0;
    }

    .data-table td.actions-cell {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .data-table td.actions-cell::before {
        content: 'Actions';
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    .actions-cell {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .actions-cell button {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .btn-edit,
    .btn-tarif,
    .btn-delete,
    .btn-chauffeur-hist,
    .btn-entretien,
    .btn-carburant,
    .btn-vehicule,
    .btn-accident,
    .btn-reference {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    /* Graphiques */
    .chiffre-affaires-summary-cards {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1rem;
        max-height: 90vh;
    }

    .entretien-container {
        grid-template-columns: 1fr;
    }

    /* Calendar */
    .calendar-body {
        max-height: 400px;
        overflow-x: auto;
    }

    .days-header {
        min-width: 600px;
    }

    .calendar-cells {
        min-width: 600px;
    }

    .available-items {
        flex-direction: column;
        width: 100%;
    }

    .items-column {
        min-width: 100%;
    }

    /* Grille des graphiques */
    div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .admin-logo h1 {
        font-size: 0.9rem;
    }

    .admin-user span {
        display: none;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .btn-add {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    .booking-item {
        width: 100% !important;
        font-size: 0.7rem;
    }

    .modal-content {
        padding: 0.75rem;
    }
}

/* Chantiers Styles */
.statut-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statut-planifie {
    background: #dbeafe;
    color: #1e40af;
}

.statut-en-cours {
    background: #fef3c7;
    color: #92400e;
}

.statut-termine {
    background: #d1fae5;
    color: #065f46;
}

.statut-annule {
    background: #fee2e2;
    color: #991b1b;
}

.suivi-chantiers-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.stat-card p {
    margin: 0.5rem 0 0 0;
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chantiers-list {
    margin-top: 2rem;
}

.chantiers-list h3 {
    margin: 2rem 0 1rem 0;
    color: var(--text-dark);
    font-size: 1.25rem;
}

.chantiers-list h3:first-child {
    margin-top: 0;
}

.chantiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chantier-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chantier-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.chantier-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.chantier-card-header h4 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.chantier-card-body {
    padding: 1.5rem;
}

.chantier-card-body p {
    margin: 0.5rem 0;
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.6;
}

.chantier-card-body strong {
    color: var(--text-dark);
    font-weight: 600;
}

.chantier-card-actions {
    padding: 1rem 1.5rem;
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-edit,
.btn-delete {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: var(--primary-color);
    color: var(--bg-white);
}

.btn-edit:hover {
    background: var(--secondary-color);
}

.btn-delete {
    background: var(--danger-color);
    color: var(--bg-white);
}

.btn-delete:hover {
    background: #dc2626;
}

.chantier-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chantier-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chantier-form label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.chantier-form input,
.chantier-form select,
.chantier-form textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.chantier-form input:focus,
.chantier-form select:focus,
.chantier-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chantier-form small {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: -0.25rem;
}

/* Bouton de bascule du thème */
.btn-theme-toggle {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 1rem;
    color: var(--text-dark);
}

.btn-theme-toggle:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Thème sombre */
body.dark-theme {
    --primary-color: #3b82f6;
    --secondary-color: #2563eb;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-dark: #e5e7eb;
    --text-light: #9ca3af;
    --bg-light: #1f2937;
    --bg-white: #111827;
    --border-color: #374151;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    background-color: #0f172a;
    color: var(--text-dark);
}

body.dark-theme .btn-theme-toggle {
    color: var(--text-dark);
    border-color: var(--border-color);
}

body.dark-theme .btn-theme-toggle:hover {
    background: var(--bg-light);
}

/* Adaptations spécifiques pour le thème sombre */
body.dark-theme .admin-header {
    background: var(--bg-white);
    border-bottom-color: var(--border-color);
}

body.dark-theme .admin-sidebar {
    background: var(--bg-white);
    border-right-color: var(--border-color);
}

body.dark-theme .admin-content {
    background: var(--bg-light);
}

body.dark-theme .login-box {
    background: var(--bg-white);
    color: var(--text-dark);
}

body.dark-theme .login-header h1 {
    color: var(--primary-color);
}

body.dark-theme .login-header h2 {
    color: var(--text-light);
}

body.dark-theme .card,
body.dark-theme .data-card,
body.dark-theme .stat-card {
    background: var(--bg-white);
    border-color: var(--border-color);
    color: var(--text-dark);
}

body.dark-theme .data-table {
    background: var(--bg-white);
    color: var(--text-dark);
}

body.dark-theme .data-table th {
    background: var(--bg-light);
    color: var(--text-dark);
    border-color: var(--border-color);
}

body.dark-theme .data-table td {
    border-color: var(--border-color);
}

body.dark-theme .form-group label {
    color: var(--text-dark);
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background: var(--bg-light);
    color: var(--text-dark);
    border-color: var(--border-color);
}

body.dark-theme input:focus,
body.dark-theme select:focus,
body.dark-theme textarea:focus {
    border-color: var(--primary-color);
    background: var(--bg-white);
}

body.dark-theme .modal {
    background: rgba(0, 0, 0, 0.8);
}

body.dark-theme .modal-content {
    background: var(--bg-white);
    color: var(--text-dark);
}

body.dark-theme .calendar-cell {
    background: var(--bg-white);
    border-color: var(--border-color);
}

body.dark-theme .booking-item {
    border-color: var(--border-color);
}

body.dark-theme .context-menu {
    background: var(--bg-white);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

body.dark-theme .context-menu-item {
    color: var(--text-dark);
}

body.dark-theme .context-menu-item:hover {
    background: var(--bg-light);
}

body.dark-theme .nav-item {
    color: var(--text-dark);
}

body.dark-theme .nav-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

body.dark-theme .nav-item.active {
    background: var(--primary-color);
    color: white;
}

body.dark-theme .nav-category-title {
    color: var(--text-light);
}

body.dark-theme .btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border-color: var(--border-color);
}

body.dark-theme .btn-secondary:hover {
    background: var(--border-color);
}

body.dark-theme .btn-cancel {
    background: var(--bg-light);
    color: var(--text-dark);
    border-color: var(--border-color);
}

body.dark-theme .btn-cancel:hover {
    background: var(--border-color);
}

body.dark-theme .booking-factured {
    color: var(--text-light);
}

body.dark-theme .factured {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}
