:root {
    --primary-color: #ed1c2e; /* Rouge Antargaz */
    --secondary-color: #69cb35; /* Vert Antargaz */
    --accent-color: #f0f7ea; /* Vert clair - thème nature */
    --text-color: #333;
    --light-bg: #f8f9fa;
    --light-gray: #e9ecef;
    --medium-gray: #ced4da;
    --dark-gray: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--accent-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: white;
    padding: 1rem 2rem;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    height: 60px;
}

.header-title {
    display: flex;
    align-items: center;
}

.header-title h1 {
    font-size: 1.8rem;
    margin-left: 10px;
    color: var(--primary-color);
}

.header-title i {
    font-size: 2rem;
    color: var(--secondary-color);
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 0.75rem;
}

.section-title i {
    margin-right: 0.75rem;
    color: var(--secondary-color);
}

.upload-container {
    border: 2px dashed var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
    background-color: var(--light-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-container:hover {
    border-color: var(--secondary-color);
    background-color: #eef7e4;
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.upload-text {
    color: var(--dark-gray);
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
}

.btn i {
    margin-right: 0.5rem;
}

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

.btn-primary:hover {
    background-color: #d01625;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: #58b428;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

.file-info {
    display: flex;
    align-items: center;
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.file-info i {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-right: 1rem;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text-color);
}

.file-size {
    color: var(--dark-gray);
    font-size: 0.9rem;
}

.progress-container {
    width: 100%;
    background-color: var(--light-gray);
    border-radius: 0.5rem;
    margin: 1rem 0;
    height: 0.75rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
    border-radius: 0.5rem;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.status-message {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--border-radius);
    background-color: #e5f5d7;
    border-left: 4px solid var(--secondary-color);
}

.status-message i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
    color: var(--secondary-color);
}

.status-message.error {
    background-color: #fde8e8;
    border-left-color: var(--primary-color);
}

.status-message.error i {
    color: var(--primary-color);
}

.results-table-container {
    margin-top: 1rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--primary-color);
}

tr:hover {
    background-color: #f0f7ea;
}

.coordinates-cell {
    font-family: monospace;
    background-color: #f7f7f7;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

.result-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 5px solid var(--secondary-color);
}

.result-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.result-title i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.detail-group {
    padding: 0.5rem;
}

.detail-label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: var(--text-color);
    background-color: var(--light-bg);
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    flex: 1;
    min-width: 150px;
    background-color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-item.success .stat-value {
    color: var(--secondary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--dark-gray);
}

.empty-state i {
    font-size: 3rem;
    color: var(--light-gray);
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

footer {
    background-color: white;
    padding: 1.5rem;
    text-align: center;
    color: var(--dark-gray);
    margin-top: auto;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.05);
}

.footer-logo {
    height: 40px;
    margin-bottom: 1rem;
}

/* Onglets de mode */
.mode-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--medium-gray);
}

.mode-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--dark-gray);
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.mode-tab i {
    margin-right: 8px;
}

.mode-tab:hover {
    color: var(--primary-color);
    background-color: var(--accent-color);
}

.mode-tab.active {
    border-bottom: 3px solid var(--primary-color);
    color: var(--primary-color);
}

/* Mode contenu */
.mode-content {
    animation: fadeIn 0.3s;
}

/* Formulaire d'adresse unique */
.single-address-form {
    background-color: var(--light-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--medium-gray);
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.autocomplete-container {
    position: relative;
    flex: 1;
    min-width: 0; /* Permet à l'élément de rétrécir si nécessaire */
}

.address-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
    min-width: 300px; /* Largeur minimale */
}

.address-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(237, 28, 46, 0.15);
}

/* Bouton de recherche */
#searchBtn {
    min-width: 140px;
    white-space: nowrap;
    flex-shrink: 0; /* Empêche le bouton de rétrécir */
}

/* Autocomplétion */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--medium-gray);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--light-gray);
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: var(--accent-color);
}

.autocomplete-item .address-main {
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.4;
}

.autocomplete-item .address-context {
    font-size: 0.875rem;
    color: var(--dark-gray);
    margin-top: 0.25rem;
}

.autocomplete-loading,
.autocomplete-no-results {
    padding: 0.75rem 1rem;
    text-align: center;
    color: var(--dark-gray);
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .address-input {
        min-width: auto;
    }
    
    #searchBtn {
        min-width: auto;
    }
    
    .single-address-form {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .single-address-form {
        padding: 1rem;
    }
    
    .address-input {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

/* Amélioration de l'apparence générale */
.single-address-form p {
    margin-bottom: 1.5rem;
    color: var(--dark-gray);
    line-height: 1.5;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .result-details {
        grid-template-columns: 1fr;
    }
    
    .stats {
        flex-direction: column;
    }
}

/* Section de téléchargement PDF */
.pdf-download-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: flex-end;
}

.download-pdf-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.download-pdf-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.download-pdf-btn i {
    margin-right: 0.5rem;
}

.download-pdf-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.download-pdf-btn.loading::after {
    content: '';
    margin-left: 0.5rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Section des boutons de téléchargement */
.download-buttons-section {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--light-gray);
}

.download-buttons-section .btn {
    flex: 1;
    min-width: 200px;
}

/* Styles pour le bouton en état de chargement */
.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading i.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Animation de rotation pour le spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive pour les boutons de téléchargement */
@media (max-width: 768px) {
    .download-buttons-section {
        flex-direction: column;
    }
    
    .download-buttons-section .btn {
        min-width: auto;
    }
}