/**
 * ByAuto Provence Booking - Styles Frontend
 * Version: 1.0.0
 * Description: Styles modernes et responsives pour le module de réservation
 */

/* Import de la police Montserrat */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');

/* Variables CSS personnalisables */
:root {
    --byauto-primary-color: #f45a5a;
    --byauto-secondary-color: #e04545;
    --byauto-text-color: #ffffff;
    --byauto-border-radius: 12px;
    --byauto-shadow: 0 4px 8px rgba(0,0,0,0.15);
    --byauto-transition: all 0.3s ease;
    --byauto-gradient: linear-gradient(135deg, var(--byauto-primary-color) 0%, var(--byauto-secondary-color) 100%);
    --byauto-hover-transform: translateY(-2px);
    --byauto-focus-ring: 0 0 0 3px rgba(244, 90, 90, 0.3);
    --pro-booking-button-color: #f45a5a;
    
    /* Variables par défaut pour les nouvelles options du bouton */
    --byauto-button-font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --byauto-button-font-size: 16px;
    --byauto-button-font-weight: 600;
    --byauto-button-text-transform: none;
    --byauto-button-padding: 12px 24px;
    --byauto-button-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    --byauto-button-hover-transform: translateY(-2px);
    --byauto-button-transition-duration: 0.3s;
}

/* Reset et base */
.byauto-booking-wrapper *,
.byauto-booking-button-wrapper * {
    box-sizing: border-box;
}

/* Conteneur principal du module de réservation */
.byauto-booking-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Amélioration du widget pro-booking existant */
.byauto-booking-wrapper .pro-booking-calendar {
    background: #ffffff;
    border-radius: var(--byauto-border-radius);
    box-shadow: var(--byauto-shadow);
    padding: 2rem;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    transition: var(--byauto-transition);
    border: 1px solid rgba(244, 90, 90, 0.1);
    position: relative;
    overflow: hidden;
}

/* Effet de survol sur le conteneur */
.byauto-booking-wrapper .pro-booking-calendar:hover {
    transform: var(--byauto-hover-transform);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Pseudo-élément pour l'effet de brillance */
.byauto-booking-wrapper .pro-booking-calendar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.byauto-booking-wrapper .pro-booking-calendar:hover::before {
    left: 100%;
}

/* Groupes de champs */
.byauto-booking-wrapper .booking-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
    flex: 1;
}

/* Labels pour les champs */
.byauto-booking-wrapper .booking-group::before {
    content: attr(data-label);
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

/* Styles des champs de saisie */
.byauto-booking-wrapper .date-input,
.byauto-booking-wrapper .time-select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--byauto-border-radius);
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    transition: var(--byauto-transition);
    margin: 0;
    position: relative;
}

/* États de focus des champs */
.byauto-booking-wrapper .date-input:focus,
.byauto-booking-wrapper .time-select:focus {
    outline: none;
    border-color: var(--byauto-primary-color);
    box-shadow: var(--byauto-focus-ring);
    transform: scale(1.02);
}

/* Amélioration du champ de date */
.byauto-booking-wrapper .date-input {
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2V6M14 2V6M3 10H17M5 4H15C16.1046 4 17 4.89543 17 6V16C17 17.1046 16.1046 18 15 18H5C3.89543 18 3 17.1046 3 16V6C3 4.89543 3.89543 4 5 4Z' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px 20px;
    padding-right: 3rem;
}

/* Amélioration du sélecteur de temps */
.byauto-booking-wrapper .time-select {
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18Z' stroke='%236B7280' stroke-width='2'/%3E%3Cpath d='M10 6V10L13 13' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px 20px;
    padding-right: 3rem;
    appearance: none;
    cursor: pointer;
}

/* Bouton de réservation principal */
.byauto-booking-wrapper #book_now,
.byauto-booking-button {
    /* Utilisation des nouvelles variables CSS personnalisables */
    font-family: var(--byauto-button-font-family) !important;
    font-size: var(--byauto-button-font-size) !important;
    font-weight: var(--byauto-button-font-weight) !important;
    text-transform: var(--byauto-button-text-transform) !important;
    padding: var(--byauto-button-padding) !important;
    box-shadow: var(--byauto-button-shadow) !important;
    transition: all var(--byauto-button-transition-duration) ease !important;
    
    /* Styles de base */
    background: var(--byauto-gradient) !important;
    background-color: var(--byauto-primary-color) !important;
    color: var(--byauto-text-color) !important;
    border: none !important;
    border-radius: var(--byauto-border-radius) !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: hidden !important;
    min-width: 200px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

/* Style spécifique pour le bouton avec ID book_now - Priorité maximale contre Flatpickr */
button#book_now,
button[id="book_now"],
#book_now,
.flatpickr-calendar #book_now,
.flatpickr-wrapper #book_now,
body #book_now {
    /* Utilisation des nouvelles variables CSS personnalisables */
    font-family: var(--byauto-button-font-family) !important;
    font-size: var(--byauto-button-font-size) !important;
    font-weight: var(--byauto-button-font-weight) !important;
    text-transform: var(--byauto-button-text-transform) !important;
    padding: var(--byauto-button-padding) !important;
    box-shadow: var(--byauto-button-shadow) !important;
    transition: all var(--byauto-button-transition-duration) ease !important;
    
    /* Styles de base conservés */
    background: var(--byauto-primary-color, #f45a5a) !important;
    background-color: var(--byauto-primary-color, #f45a5a) !important;
    background-image: none !important;
    border: none !important;
    color: var(--byauto-text-color, #ffffff) !important;
    border-radius: var(--byauto-border-radius, 12px) !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    line-height: 1.4 !important;
    min-height: auto !important;
    width: auto !important;
    height: auto !important;
    box-sizing: border-box !important;
    outline: none !important;
    text-shadow: none !important;
    --pro-booking-button-color: var(--byauto-primary-color, #f45a5a) !important;
}

button#book_now:hover,
button[id="book_now"]:hover,
#book_now:hover,
.flatpickr-calendar #book_now:hover,
.flatpickr-wrapper #book_now:hover,
body #book_now:hover {
    background: var(--byauto-secondary-color, #e04545) !important;
    background-color: var(--byauto-secondary-color, #e04545) !important;
    background-image: none !important;
    transform: var(--byauto-button-hover-transform) !important;
    box-shadow: 0 8px 25px rgba(244, 90, 90, 0.3) !important;
    color: var(--byauto-text-color, #ffffff) !important;
    border: none !important;
    outline: none !important;
    --pro-booking-button-color: var(--byauto-secondary-color, #e04545) !important;
}

button#book_now:active,
button[id="book_now"]:active,
#book_now:active,
.flatpickr-calendar #book_now:active,
.flatpickr-wrapper #book_now:active,
body #book_now:active {
    background: #cc3030 !important;
    background-color: #cc3030 !important;
    background-image: none !important;
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(244, 90, 90, 0.3) !important;
    color: #ffffff !important;
    border: none !important;
    outline: none !important;
    --pro-booking-button-color: #cc3030 !important;
}

/* Forcer le texte du bouton - Priorité maximale */
button#book_now::after,
button[id="book_now"]::after,
#book_now::after,
.flatpickr-calendar #book_now::after,
.flatpickr-wrapper #book_now::after,
body #book_now::after {
    content: "Réservez votre parking" !important;
    display: inline !important;
    font-weight: 600 !important;
    color: #ffffff !important;
}

/* Masquer le contenu existant */
button#book_now *,
button[id="book_now"] *,
#book_now *,
.flatpickr-calendar #book_now *,
.flatpickr-wrapper #book_now *,
body #book_now * {
    display: none !important;
    visibility: hidden !important;
}

/* Forcer le texte directement dans le bouton */
button#book_now,
button[id="book_now"],
#book_now {
    text-indent: -9999px !important;
    font-size: 0 !important;
}

button#book_now::before,
button[id="book_now"]::before,
#book_now::before {
    content: "Réservez votre parking" !important;
    text-indent: 0 !important;
    display: block !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.4 !important;
}

/* Surcharger tous les styles externes possibles */
.pro-booking-calendar #book_now,
.pro-booking-form #book_now,
div[id*="pro-booking"] #book_now,
[class*="pro-booking"] #book_now {
    background: #f45a5a !important;
    background-color: #f45a5a !important;
    background-image: none !important;
    border: none !important;
    color: #ffffff !important;
}

.pro-booking-calendar #book_now:hover,
.pro-booking-form #book_now:hover,
div[id*="pro-booking"] #book_now:hover,
[class*="pro-booking"] #book_now:hover {
    background: #e04545 !important;
    background-color: #e04545 !important;
    background-image: none !important;
    color: #ffffff !important;
}

/* Effet de survol du bouton */
.byauto-booking-wrapper #book_now:hover,
.byauto-booking-button:hover {
    background: var(--byauto-secondary-color) !important;
    background-color: var(--byauto-secondary-color) !important;
    color: var(--byauto-text-color) !important;
    transform: var(--byauto-button-hover-transform) !important;
    box-shadow: 0 8px 25px rgba(244, 90, 90, 0.3) !important;
    filter: brightness(1.1) !important;
}

/* Force la couleur du texte au survol */
.byauto-booking-wrapper #book_now:hover,
.byauto-booking-wrapper #book_now:hover *,
.byauto-booking-button:hover,
.byauto-booking-button:hover * {
    color: var(--byauto-text-color) !important;
}

/* Effet de clic du bouton */
.byauto-booking-wrapper #book_now:active,
.byauto-booking-button:active {
    background: #cc3030 !important;
    background-color: #cc3030 !important;
    color: var(--byauto-text-color) !important;
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(244, 90, 90, 0.3) !important;
}

/* Force la couleur du texte au clic */
.byauto-booking-wrapper #book_now:active,
.byauto-booking-wrapper #book_now:active *,
.byauto-booking-button:active,
.byauto-booking-button:active * {
    color: var(--byauto-text-color) !important;
}

/* Icône dans le bouton */
.byauto-booking-wrapper #book_now::before,
.byauto-booking-button::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2V6M14 2V6M3 10H17M5 4H15C16.1046 4 17 4.89543 17 6V16C17 17.1046 16.1046 18 15 18H5C3.89543 18 3 17.1046 3 16V6C3 4.89543 3.89543 4 5 4Z' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Styles pour les variantes carrées */
.byauto-booking-wrapper .style-square .pro-booking-calendar,
.byauto-booking-wrapper .style-square .date-input,
.byauto-booking-wrapper .style-square .time-select,
.byauto-booking-wrapper .style-square #book_now,
.byauto-booking-button.style-square {
    border-radius: 8px;
}

/* Animation de chargement */
.byauto-booking-wrapper.loading {
    position: relative;
}

.byauto-booking-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.byauto-booking-wrapper.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--byauto-primary-color);
    border-radius: 50%;
    animation: byauto-spin 1s linear infinite;
    z-index: 11;
}

@keyframes byauto-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .byauto-booking-wrapper {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }
    
    .byauto-booking-wrapper .pro-booking-calendar {
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 1rem;
    }
    
    .byauto-booking-wrapper .booking-group {
        width: 100%;
        min-width: unset;
    }
    
    .byauto-booking-wrapper .date-input,
    .byauto-booking-wrapper .time-select {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .byauto-booking-wrapper #book_now,
    .byauto-booking-button {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .byauto-booking-wrapper .pro-booking-calendar {
        padding: 1rem 0.75rem;
    }
    
    .byauto-booking-wrapper .date-input,
    .byauto-booking-wrapper .time-select {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* Amélioration de l'accessibilité */
.byauto-booking-wrapper .date-input:focus-visible,
.byauto-booking-wrapper .time-select:focus-visible,
.byauto-booking-wrapper #book_now:focus-visible,
.byauto-booking-button:focus-visible {
    outline: 2px solid var(--byauto-primary-color);
    outline-offset: 2px;
}

/* Mode sombre (si supporté par le thème) */
@media (prefers-color-scheme: dark) {
    .byauto-booking-wrapper .pro-booking-calendar {
        background: #1f2937;
        border-color: rgba(244, 90, 90, 0.3);
    }
    
    .byauto-booking-wrapper .date-input,
    .byauto-booking-wrapper .time-select {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .byauto-booking-wrapper .booking-group::before {
        color: #d1d5db;
    }
}

/* Animation d'entrée */
.byauto-booking-wrapper {
    animation: byauto-fadeInUp 0.6s ease-out;
}

@keyframes byauto-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles pour les messages d'erreur/succès */
.byauto-booking-message {
    padding: 1rem;
    border-radius: var(--byauto-border-radius);
    margin: 1rem 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.byauto-booking-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.byauto-booking-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.byauto-booking-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Styles supplémentaires pour la personnalisation avancée du bouton */
.byauto-booking-button-wrapper .byauto-booking-button {
    font-family: var(--byauto-button-font-family) !important;
    font-size: var(--byauto-button-font-size) !important;
    font-weight: var(--byauto-button-font-weight) !important;
    text-transform: var(--byauto-button-text-transform) !important;
    padding: var(--byauto-button-padding) !important;
    box-shadow: var(--byauto-button-shadow) !important;
    transition: all var(--byauto-button-transition-duration) ease !important;
}

.byauto-booking-button-wrapper .byauto-booking-button:hover {
    transform: var(--byauto-button-hover-transform) !important;
}

/* Support pour les polices personnalisées */
.byauto-booking-wrapper,
.byauto-booking-button,
#book_now {
    font-display: swap; /* Améliore les performances de chargement des polices */
}

/* Styles pour assurer la compatibilité avec tous les shortcodes */
[id*="byauto-booking"] .byauto-booking-button,
[class*="byauto-booking"] .byauto-booking-button,
div[data-byauto] .byauto-booking-button {
    font-family: var(--byauto-button-font-family) !important;
    font-size: var(--byauto-button-font-size) !important;
    font-weight: var(--byauto-button-font-weight) !important;
    text-transform: var(--byauto-button-text-transform) !important;
    padding: var(--byauto-button-padding) !important;
    box-shadow: var(--byauto-button-shadow) !important;
    transition: all var(--byauto-button-transition-duration) ease !important;
}

/* Optimisation des performances */
.byauto-booking-wrapper * {
    will-change: transform;
}

.byauto-booking-wrapper .pro-booking-calendar {
    contain: layout style paint;
}

/* Print styles */
@media print {
    .byauto-booking-wrapper {
        display: none;
    }
}