/* Styles communs pour l'application de gestion de garage */

/* ===== CSS CUSTOM PROPERTIES (Variables) ===== */
:root {
    /* PRIMAIRES */
    --primary: #3498DB;           /* Bleu (boutons CTA, actions principales) */
    --primary-dark: #2980B9;      /* Bleu foncé (hover) */
    --primary-light: #5DADE2;     /* Bleu clair */

    /* NAVY DOMINANT */
    --navy: #0A0E27;              /* Navy MonGaragePro (header, footer, titres) */
    --navy-light: #1A1E37;        /* Navy légèrement plus clair */

    /* ACCENT ORANGE */
    --accent-brand: #FF4D00;      /* Orange MonGaragePro (logo "Garage", icônes) */
    --accent-brand-light: #FF7A3D; /* Orange clair */

    /* AUTRES ACCENTS */
    --accent-success: #28A745;    /* Vert (succès, validations) */
    --accent-warning: #FFC107;    /* Jaune (alertes) */
    --accent-danger: #DC3545;     /* Rouge (erreurs) */

    /* NEUTRES */
    --text-dark: #2C3E50;         /* Texte principal */
    --text-medium: #6B7280;       /* Texte secondaire */
    --text-light: #999999;        /* Texte tertiaire */

    /* BACKGROUNDS */
    --bg-body: #F4F4F4;           /* Background principal */
    --bg-white: #FFFFFF;          /* Cards, modals */
    --bg-light: #F8F9FA;          /* Info-items, sections alternées */
    --border: #DDDDDD;            /* Bordures */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg-body);
}

/* Header */
.header {
    background: var(--navy);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 24px;
}

.nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    transition: background 0.3s;
}

.nav a:hover {
    background: rgba(255,255,255,0.2);
}

.nav a.active {
    background: var(--primary);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

@media (max-width: 600px) {
    .container {
        padding: 0 12px;
        margin: 15px auto;
    }
}

/* Alertes */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert .close-btn {
    margin-left: auto;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    color: inherit;
    opacity: 0.7;
}

.alert .close-btn:hover {
    opacity: 1;
}

/* Boutons - Charte graphique standardisée */
.btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
}

.btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(34, 153, 84, 0.3);
}

.btn:active {
    transform: translateY(1px);
}

/* Variante primaire (vert) - par défaut */
.btn-primary {
    background: var(--primary);
}

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

/* Variante secondaire (bleu) */
.btn-secondary {
    background: var(--primary);
}

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

/* Variante info (cyan) */
.btn-info {
    background: #17a2b8;
}

.btn-info:hover {
    background: #138496;
}

/* Variante succès (vert clair) */
.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

/* Variante avertissement (orange) */
.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Variante danger (rouge) */
.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

/* Variante secondaire/outline (violet) */
.btn-purple {
    background: #6f42c1;
}

.btn-purple:hover {
    background: #5a32a3;
}

/* Tailles des boutons */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-md {
    padding: 10px 20px;
    font-size: 14px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow-x: auto;
}

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

th {
    background: var(--navy);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background: #f8f8f8;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Cards */
.card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--navy);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card .number {
    font-size: 32px;
    font-weight: bold;
    color: var(--navy);
    margin-bottom: 5px;
}

.stat-card .label {
    color: #666;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 20px;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.pagination a:hover {
    background: #f0f0f0;
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Actions */
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.actions a {
    padding: 5px 10px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
}

.actions a:hover {
    background: var(--primary-dark);
}

.actions a.delete {
    background: #dc3545;
}

.actions a.delete:hover {
    background: #c82333;
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.info-label {
    font-weight: bold;
    color: #666;
    font-size: 12px;
    margin-bottom: 5px;
}

.info-value {
    font-size: 16px;
    color: var(--navy);
}

/* Search bar */
.search-bar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-bar form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-header {
    background: var(--navy);
    color: white;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.close {
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #ccc;
}

.modal-body {
    padding: 25px;
}

/* Page Garages */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.garages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .garages-grid {
        grid-template-columns: 1fr;
    }
}

.garage-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
}

.garage-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.garage-card.inactive {
    opacity: 0.6;
}

.garage-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.garage-logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.garage-logo-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.garage-info h3 {
    margin: 0;
    color: var(--navy);
}

.garage-status {
    font-size: 12px;
    font-weight: 500;
}

.garage-status.active {
    color: var(--primary);
}

.garage-status.inactive {
    color: #95a5a6;
}

.garage-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--navy);
}

.garage-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.garage-footer {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Button sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Form styles */
.form-container {
    max-width: 600px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--navy);
}

/* Labels for checkboxes without for attribute - inline */
.form-group > label:has(input[type="checkbox"]),
.form-group > label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 10px;
    cursor: pointer;
}

.form-group > label:has(input[type="checkbox"]) input[type="checkbox"],
.form-group > label:has(input[type="radio"]) input[type="radio"] {
    margin-right: 8px;
    margin-bottom: 0;
    width: auto;
    cursor: pointer;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Checkboxes and radio buttons standalone */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    padding: 0;
    border: none;
    cursor: pointer;
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }

    .garages-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Font Awesome - Ajustements icônes
   ============================================ */

/* Espacement uniforme */
.intervention-category-title i,
.checkbox-label i {
    margin-right: 6px;
    width: 16px;
    display: inline-block;
    text-align: center;
}

/* Icônes doubles - réduire espacement */
.checkbox-label i + i {
    margin-right: 4px;
    margin-left: -2px;
}

/* Taille catégories */
.intervention-category-title i {
    font-size: 16px;
}

/* Couleurs par catégorie */
.intervention-category:nth-child(1) .intervention-category-title i { color: #f39c12; } /* Vidange */
.intervention-category:nth-child(2) .intervention-category-title i { color: #e74c3c; } /* Freinage */
.intervention-category:nth-child(3) .intervention-category-title i { color: var(--navy); } /* Pneus */
.intervention-category:nth-child(4) .intervention-category-title i { color: #7f8c8d; } /* Moteur */
.intervention-category:nth-child(5) .intervention-category-title i { color: var(--primary); } /* Direction */
.intervention-category:nth-child(6) .intervention-category-title i { color: #9b59b6; } /* Transmission */
.intervention-category:nth-child(7) .intervention-category-title i { color: #f1c40f; } /* Électricité */
.intervention-category:nth-child(8) .intervention-category-title i { color: #95a5a6; } /* Divers */

/* Effet hover */
.checkbox-label:hover i {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* ============================================
   Optimisation du tableau des interventions
   ============================================ */

/* Wrapping pour colonnes de texte */
table td:nth-child(3) {  /* Véhicule */
    word-break: break-word;
}
table td:nth-child(6) {  /* Interventions */
    text-align: center;
    word-break: break-word;
}

/* Colonne Actions - flexbox pour wrapping des boutons */
table td:nth-child(10) {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: auto;
}

/* Actions - boutons côte à côte */
.actions {
    gap: 8px;
    justify-content: center;
}

.actions a {
    padding: 6px 8px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Grille responsive pour documents (CT et carte grise)
   ============================================ */
.documents-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .documents-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Responsive utilities
   ============================================ */

/* Column visibility helpers for tables */
@media (max-width: 768px) {
    .col-hide-mobile {
        display: none;
    }
}

/* Page header responsive */
@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header h1 {
        font-size: 20px;
    }
}

/* Touch-friendly minimum tap targets on mobile */
@media (max-width: 768px) {
    .actions a,
    .actions button {
        min-height: 36px;
        padding: 8px 12px;
    }
}

/* Client portal header - responsive fix */
@media (max-width: 600px) {
    .client-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 15px;
    }
    .client-info {
        width: 100%;
        justify-content: space-between;
    }
    .client-name {
        font-size: 14px;
    }
    .btn-logout {
        padding: 6px 12px;
        font-size: 13px;
    }
    .client-logo h1 {
        font-size: 16px;
    }
}
