/**
 * Distance Price Calculator - Frontend Styles
 * Design responsive et moderne
 */

/* Conteneur principal */
.dpc-calculator-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Titre */
.dpc-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

/* Sous-titre */
.dpc-subtitle {
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    color: #667eea;
    text-align: center;
    font-weight: 500;
}

/* Formulaire */
.dpc-calculator-form {
    margin-bottom: 2rem;
}

/* Groupes de formulaire */
.dpc-form-group {
    margin-bottom: 1.5rem;
}

.dpc-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.95rem;
}

.dpc-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 2px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.dpc-input:focus {
    color: #495057;
    background-color: #fff;
    border-color: #3498db;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dpc-input::placeholder {
    color: #999;
    opacity: 1;
}

/* Forcer le style sur autofill (Chrome, Safari) */
.dpc-input:-webkit-autofill,
.dpc-input:-webkit-autofill:hover,
.dpc-input:-webkit-autofill:focus,
.dpc-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #495057 !important;
    background-color: #fff !important;
}

/* Forcer le style sur autofill (Firefox) */
.dpc-input:-moz-autofill,
.dpc-input:-moz-autofill:hover,
.dpc-input:-moz-autofill:focus {
    background-color: #fff !important;
    color: #495057 !important;
}

/* Sélecteur */
.dpc-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
}

.dpc-select:focus {
    color: #495057;
    background-color: #fff;
    border-color: #3498db;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dpc-select option {
    padding: 0.5rem;
    background-color: #fff;
    color: #495057;
}

/* Texte d'aide */
.dpc-help-text {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

/* Bouton principal */
.dpc-button {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.dpc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.dpc-button:active {
    transform: translateY(0);
}

.dpc-button-disabled,
.dpc-button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* Chargement */
.dpc-loading {
    margin-top: 1.5rem;
    padding: 1rem;
    text-align: center;
    color: #3498db;
    font-weight: 500;
}

.dpc-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: dpc-spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes dpc-spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.dpc-message {
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.dpc-error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.dpc-success {
    background-color: #efe;
    border: 1px solid #cfc;
    color: #3c3;
}

/* Alertes */
.dpc-alert {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.dpc-alert-warning {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
}

.dpc-alert-info {
    background-color: #d1ecf1;
    border: 2px solid #17a2b8;
    color: #0c5460;
}

.dpc-alert strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.dpc-alert p {
    margin: 0.5rem 0 0 0;
    line-height: 1.6;
}

.dpc-alert a {
    color: #0066cc;
    text-decoration: underline;
    font-weight: 600;
}

.dpc-alert a:hover {
    color: #004499;
}

/* Suggestions d'autocomplétion OpenStreetMap */
.dpc-form-group {
    position: relative;
}

.dpc-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 2px solid #3498db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: -8px;
    display: none;
}

.dpc-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.15s ease;
    font-size: 0.95rem;
    color: #495057;
}

.dpc-suggestion-item:last-child {
    border-bottom: none;
}

.dpc-suggestion-item:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

.dpc-suggestions::-webkit-scrollbar {
    width: 8px;
}

.dpc-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 8px 0;
}

.dpc-suggestions::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

.dpc-suggestions::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Résultats */
.dpc-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 12px;
    border: 2px solid #667eea30;
}

.dpc-results-title {
    margin: 0 0 1.25rem 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.dpc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dpc-result-item:last-child {
    margin-bottom: 0;
}

.dpc-result-label {
    font-weight: 500;
    color: #34495e;
    font-size: 1rem;
}

.dpc-result-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

/* Prix total - mise en évidence */
.dpc-result-price {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: 1rem;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.dpc-result-price .dpc-result-label,
.dpc-result-price .dpc-result-value {
    color: #ffffff;
    font-size: 1.2rem;
}

.dpc-result-price .dpc-result-value {
    font-size: 1.6rem;
    font-weight: 700;
}

/* Champs date et heure sur la même ligne */
.dpc-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dpc-form-half {
    flex: 1;
    margin-bottom: 0 !important;
}

/* Style pour les champs date et time */
input[type="date"],
input[type="time"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 2px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

input[type="date"]:focus,
input[type="time"]:focus {
    border-color: #3498db;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Formulaire de réservation */
.dpc-booking-form {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #00a32a30;
}

.dpc-booking-title {
    margin: 0 0 1.25rem 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.dpc-button-success {
    background: linear-gradient(135deg, #00a32a 0%, #00842a 100%);
    box-shadow: 0 4px 15px rgba(0, 163, 42, 0.3);
}

.dpc-button-success:hover {
    box-shadow: 0 6px 20px rgba(0, 163, 42, 0.4);
}

/* Messages de succès */
.dpc-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

/* Mise en page en grille */
.dpc-main-wrapper {
    max-width: 100%;
    width: 100%;
}

.dpc-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 0;
}

.dpc-column-left,
.dpc-column-right {
    min-width: 0;
}

/* Carte interactive */
.dpc-map-container {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 100%;
    min-height: 500px;
}

.dpc-map-title {
    margin: 0 0 1rem 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
}

.dpc-map {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
}

.dpc-map.show {
    display: block;
}

.dpc-map-placeholder {
    width: 100%;
    height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6f7f7 0%, #e9ecef 100%);
    border-radius: 8px;
    color: #6c757d;
    text-align: center;
    padding: 2rem;
}

.dpc-map-placeholder svg {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.dpc-map-placeholder p {
    margin: 0;
    font-size: 1rem;
}

.dpc-map-placeholder.hide {
    display: none !important;
}

/* Styles des popups Leaflet */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 0.75rem;
    font-family: inherit;
}

/* Responsive */
@media (max-width: 1024px) {
    .dpc-grid-layout {
        grid-template-columns: 1fr;
    }

    .dpc-map-container {
        min-height: 400px;
    }

    .dpc-map,
    .dpc-map-placeholder {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .dpc-calculator-container {
        padding: 1.5rem;
        margin: 1rem;
        background: #ffffff !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    }

    .dpc-title {
        font-size: 1.5rem;
        color: #2c3e50 !important;
    }

    .dpc-subtitle {
        color: #667eea !important;
    }

    .dpc-button {
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: #ffffff !important;
        border: none !important;
    }

    /* Forcer les couleurs des inputs sur mobile */
    .dpc-input,
    .dpc-select {
        background-color: #fff !important;
        color: #495057 !important;
        border: 2px solid #ced4da !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .dpc-input:focus,
    .dpc-select:focus {
        background-color: #fff !important;
        border-color: #3498db !important;
        color: #495057 !important;
        outline: none !important;
    }

    /* Labels */
    .dpc-form-group label {
        color: #34495e !important;
        font-weight: 500 !important;
    }

    /* Résultats */
    .dpc-results {
        background: #f8f9fa !important;
        border: 2px solid #e9ecef !important;
    }

    .dpc-results-title {
        color: #2c3e50 !important;
    }

    .dpc-result-label {
        color: #34495e !important;
    }

    .dpc-result-value {
        color: #667eea !important;
        font-weight: 600 !important;
    }

    /* Formulaire de réservation */
    #dpc-booking-form {
        background: #f8f9fa !important;
        border: 2px solid #e9ecef !important;
    }

    .dpc-booking-title {
        color: #2c3e50 !important;
    }

    /* Messages */
    .dpc-error {
        background-color: #fee !important;
        border: 1px solid #fcc !important;
        color: #c33 !important;
    }

    .dpc-success {
        background-color: #efe !important;
        border: 1px solid #cfc !important;
        color: #3c3 !important;
    }

    /* Map container */
    .dpc-map-container {
        background: #ffffff !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    }

    .dpc-map-title {
        color: #2c3e50 !important;
    }

    .dpc-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .dpc-result-price {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
    }

    .dpc-result-price .dpc-result-label {
        width: 100%;
        text-align: center;
        display: block;
        color: #ffffff !important;
    }

    .dpc-result-price .dpc-result-value {
        width: 100%;
        text-align: center;
        display: block;
        color: #ffffff !important;
        white-space: nowrap;
        font-size: 1.5rem;
    }

    .dpc-form-row {
        flex-direction: column;
        gap: 0;
    }

    .dpc-form-half {
        margin-bottom: 1.5rem !important;
    }

    .dpc-map-container {
        padding: 1rem;
        min-height: 350px;
    }

    .dpc-map,
    .dpc-map-placeholder {
        height: 350px;
    }

    .dpc-grid-layout {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .dpc-calculator-container {
        padding: 1rem;
        margin: 0.5rem;
        border-radius: 8px;
        background: #ffffff !important;
    }

    .dpc-title {
        font-size: 1.3rem;
        color: #2c3e50 !important;
    }

    .dpc-subtitle {
        font-size: 0.9rem;
        color: #667eea !important;
    }

    /* Inputs et select - Éviter le zoom sur iOS */
    .dpc-input,
    .dpc-select {
        font-size: 16px !important;
        padding: 0.75rem 1rem !important;
        background-color: #fff !important;
        color: #495057 !important;
        border: 2px solid #ced4da !important;
    }

    .dpc-input:focus,
    .dpc-select:focus {
        background-color: #fff !important;
        border-color: #3498db !important;
        color: #495057 !important;
    }

    /* Boutons */
    .dpc-button {
        font-size: 1rem !important;
        padding: 0.875rem !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: #ffffff !important;
    }

    .dpc-map-container {
        min-height: 300px;
        background: #ffffff !important;
    }

    .dpc-map,
    .dpc-map-placeholder {
        height: 300px;
    }

    .dpc-result-price {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
        text-align: center !important;
        padding: 1rem !important;
    }

    .dpc-result-price .dpc-result-label {
        width: 100% !important;
        text-align: center !important;
        display: block !important;
        color: #ffffff !important;
        font-size: 1.1rem !important;
    }

    .dpc-result-price .dpc-result-value {
        width: auto !important;
        text-align: center !important;
        display: inline-block !important;
        color: #ffffff !important;
        font-size: 1.6rem !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    /* Assurer que les couleurs sont correctes sur tous les éléments */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    /* Forcer le style sur les éléments de formulaire natifs iOS/Android */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    select {
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }
}

/* Animation d'entrée */
.dpc-results {
    animation: dpc-fadeIn 0.4s ease-in-out;
}

@keyframes dpc-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibilité */
.dpc-input:focus,
.dpc-button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Mode sombre - optionnel */
@media (prefers-color-scheme: dark) {
    .dpc-calculator-container {
        background: #2c3e50;
        color: #ecf0f1;
    }

    .dpc-title,
    .dpc-results-title,
    .dpc-result-label,
    .dpc-result-value {
        color: #ecf0f1;
    }

    .dpc-form-group label {
        color: #bdc3c7;
    }

    .dpc-input {
        background-color: #34495e;
        border-color: #4a5f7f;
        color: #ecf0f1;
    }

    .dpc-input:focus {
        background-color: #34495e;
        border-color: #3498db;
    }

    .dpc-result-item {
        background: #34495e;
    }

    .dpc-results {
        background: #34495e50;
        border-color: #667eea50;
    }
}

