/* Variables globales */
:root {
    --primary-color: #304653;
    --secondary-color: #447a9c;
    --background-color: #f1faee;
    --text-color: #1d3557;
    --accent-color: #a8dadc;
    --sidebar-width: 250px;
}

/* Reset et styles de base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Structure principale du dashboard */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--text-color);
    color: white;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    padding: 1.5rem;
    z-index: 1000;
}

.logo {
    text-align: center;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.logo-img {
    max-width: 150px;
    height: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-item a i {
    width: 24px;
    margin-right: 10px;
}

.nav-item.active a,
.nav-item a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Contenu principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    background: #f8f9fa;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

/* En-tête du contenu */
.content-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Cartes et conteneurs */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Grille de statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Le graphique donut prend moins d'espace */
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-card {
    width: 100%;
}

.chart-container {
    position: relative;
    width: 100%;
    padding: 1rem;
}

.donut-container {
    max-width: 300px; /* Taille maximale fixe */
    margin: 0 auto;
}

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .donut-container {
        max-width: 250px;
    }
}

.api-key {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative; /* Ajout de position relative */
    background: #f5f5f5;
    border-radius: 4px;
    padding: 8px;
}


.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Empêche le débordement */

}

.stat-title {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-subtitle {
    font-size: 0.875rem;
    color: #888;
    margin-top: 0.25rem;
}

/* Styles de formulaire */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.1);
    outline: none;
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn i {
    margin-right: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #304653;
    transform: translateY(-1px);
}

/* Page de décodage VIN */
.search-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    width: 100%;
}

.api-key code {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-wrap;
    font-size: 0.9rem;
    -webkit-text-security: disc;
    cursor: pointer;
    word-break: break-all;
    background: transparent; /* Supprimé le background car déjà sur le parent */
    padding: 0; /* Supprimé le padding car déjà sur le parent */
}

.api-key button {
    position: static; /* Force les boutons à rester dans le flux */
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-key code:hover {
    -webkit-text-security: none;
    transition: all 0.2s ease;
}

.api-key button:hover {
    color: #333;
}


/* Documentation styles */
.endpoint-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.endpoint-section:last-child {
    border-bottom: none;
}

.endpoint-url {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
}

.endpoint-url .method {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
    background: #28a745;
    color: white;
}

.endpoint-url code {
    font-family: monospace;
    color: #e83e8c;
}

.code-examples {
    margin: 1rem 0;
}

.code-examples h4 {
    margin-bottom: 0.5rem;
    color: #6c757d;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.service-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.service-cost {
    margin-top: 0.5rem;
    color: #6c757d;
}

.service-cost i {
    color: #ffd700;
    margin-right: 0.5rem;
}

.error-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.error-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
}

.error-item h4 {
    color: #dc3545;
    margin-bottom: 0.5rem;
}

.api-auth-info {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Code block styling */
pre {
    background: #2d2d2d;
    color: #ccc;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

.results-container {
    display: grid;
    gap: 2rem;
    width: 100%;
}

.result-json {
    background: #1d1f21;
    padding: 2rem;
    border-radius: 10px;
    overflow-x: auto;
}

.result-json pre {
    margin: 0;
    color: white;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.info-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.info-item .label {
    display: block;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.info-item .value {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
}

/* Page de login */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--text-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    padding: 1rem;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Messages d'alerte */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Badges de statut */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.settings-form {
    max-width: 100%;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
        width: 250px;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation de chargement */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: white;
    font-size: 0.875rem;
}

/* Animations voiture */
.car-animation {
    position: relative;
    height: 60px;
    margin-bottom: 2rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9); /* Ajout d'un fond blanc légèrement transparent */
    border-radius: 10px;
    padding: 0.5rem;
}

.car-animation i {
    position: absolute;
    font-size: 2rem;
    color: var(--primary-color);
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2; /* S'assure que la voiture est au-dessus de la route */
}
.road {
    position: absolute;
    bottom: 10px;
    width: 100%;
    height: 2px;
    background: var(--text-color);
    left: 0; /* Assure que la route commence bien à gauche */
}

.info-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.info-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.equipment-category {
    margin-bottom: 1.5rem;
}

.equipment-category h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.equipment-list {
    list-style: none;
    padding-left: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.5rem;
}

.equipment-list li {
    position: relative;
    padding-left: 1.5rem;
    line-height: 1.4;
}

.equipment-list li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0;
}

.road::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        var(--text-color) 0px,
        var(--text-color) 20px,
        transparent 20px,
        transparent 40px
    );
    animation: roadMove 1s linear infinite;
}

.login-header .login-logo {
    max-width: 80%; /* Ajusté de 120px à 80% pour être responsif */
    height: auto;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.system-card {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary-color);
}

.system-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.system-number {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.system-header h4 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
    flex: 1;
}

.system-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.detail-label {
    font-weight: 500;
    color: #666;
    min-width: 120px;
}

.criteria-section {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.criteria-section h5 {
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.criteria-item {
    display: flex;
    flex-direction: column;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
}

.criteria-label {
    font-size: 0.85rem;
    color: #666;
}

.criteria-value {
    font-weight: 500;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.category-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.category-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.test-vins {
    margin: 20px 0;
    padding: 20px;
}

.test-vins h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.test-vins-filter {
    margin-bottom: 15px;
}

.test-vins-filter input {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.test-vins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.test-vin-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-vin-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.vin-code {
    font-family: monospace;
    font-size: 1.1em;
    color: #2c3e50;
    margin-bottom: 8px;
}

.vin-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: #6c757d;
}

.brand {
    font-weight: 600;
}

.type {
    font-style: italic;
}


.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.package-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.package-card:hover {
    transform: translateY(-5px);
}

.package-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.package-content {
    padding: 2rem;
    text-align: center;
}

.credits {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.price {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.btn-buy {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-buy:hover {
    background: var(--secondary-color);
}

/* Styles spécifiques pour la page de décodage d'immatriculation */

.test-immat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.test-immat-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-immat-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.immat-code {
    font-size: 1.2rem;
    font-weight: bold;
    color: #495057;
    margin-bottom: 0.5rem;
}

.immat-details {
    font-size: 0.9rem;
    color: #6c757d;
}

.search-form .form-control {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: monospace;
    font-size: 1.2rem;
}

/* Styles pour l'affichage des résultats */
.results-container {
    margin-top: 2rem;
}

.result-formatted {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.info-section {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

.info-section h3 {
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item .label {
    color: #6c757d;
    font-weight: 500;
}

.info-item .value {
    color: #212529;
    font-weight: 600;
}

.result-json {
    position: relative;
    background: #1e1e1e;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.result-json pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #d4d4d4;
    font-family: monospace;
}

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    background: #2d2d2d;
    border: none;
    border-radius: 0.25rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #3d3d3d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .info-item {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .info-item .label {
        font-size: 0.9rem;
    }
}

/* Loading state styles */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes roadMove {
    from { background-position: 0 0; }
    to { background-position: -40px 0; }
}

/* Menu toggle button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1002; /* Au-dessus de la sidebar */
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -250px; /* Changé de transform à left */
        transition: left 0.3s ease;
        z-index: 1001;
    }
    
    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding-top: 4rem;
        width: 100%;
    }
}