/**
 * MGA Événements - Sélecteur de dates
 * Couleur principale : #009444 (vert MGA)
 */

/* ================================
   Affichage des dates sur la page produit
   ================================ */

.mga-product-dates {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.mga-product-dates .mga-dates-label {
    font-weight: 600;
    color: #333;
}

.mga-product-dates .mga-dates-value {
    color: #666;
}

/* Permanent */
.mga-product-dates.mga-permanent-notice {
    background: #e8f5e9;
    border-color: #009444;
}

.mga-product-dates.mga-permanent-notice .mga-dates-value {
    color: #009444;
    font-weight: 600;
    text-transform: uppercase;
}

/* Pas de dates */
.mga-product-dates.mga-no-dates {
    background: #fff3e0;
    border-color: #ff9800;
}

.mga-product-dates .mga-dates-notice {
    color: #e65100;
    font-style: italic;
}

/* ================================
   Bouton trigger
   ================================ */

.mga-dates-display {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mga-dates-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #009444;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mga-dates-trigger:hover {
    background: #007a39;
    transform: translateY(-1px);
}

.mga-dates-trigger:active {
    transform: translateY(0);
}

.mga-dates-trigger .mga-dates-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.mga-dates-trigger.mga-open .mga-dates-arrow {
    transform: rotate(180deg);
}

.mga-dates-trigger.mga-has-selection {
    background: #fff;
    color: #009444;
    border: 2px solid #009444;
}

.mga-dates-trigger.mga-has-selection:hover {
    background: #e8f5e9;
}

/* ================================
   Modal
   ================================ */

.mga-dates-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mga-dates-modal.mga-visible {
    opacity: 1;
    visibility: visible;
}

.mga-dates-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.mga-dates-modal.mga-visible .mga-dates-modal-content {
    transform: scale(1) translateY(0);
}

/* Header */
.mga-dates-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #009444 !important;
    color: #fff !important;
}

.mga-dates-modal-header h3,
.mga-dates-modal .mga-dates-modal-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #fff !important;
    background: transparent !important;
    border: none !important;
}

.mga-dates-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mga-dates-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Body */
.mga-dates-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Grille des dates */
.mga-dates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 400px) {
    .mga-dates-grid {
        grid-template-columns: 1fr;
    }
}

.mga-dates-modal .mga-date-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: #f5f5f5 !important;
    border: 2px solid #ddd !important;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: #333 !important;
}

.mga-dates-modal .mga-date-option:hover {
    background: #e8f5e9 !important;
    border-color: #009444 !important;
    color: #333 !important;
}

.mga-dates-modal .mga-date-option.mga-selected {
    background: #009444 !important;
    color: #fff !important;
    border-color: #009444 !important;
}

.mga-dates-modal .mga-date-option .mga-date-day {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin-bottom: 4px;
    color: inherit !important;
}

.mga-dates-modal .mga-date-option.mga-selected .mga-date-day {
    opacity: 0.9;
    color: #fff !important;
}

.mga-dates-modal .mga-date-option .mga-date-full {
    font-size: 14px;
    font-weight: 600;
    color: inherit !important;
}

/* Footer */
.mga-dates-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
    text-align: center;
}

.mga-dates-count {
    font-size: 13px;
    color: #666;
}

/* ================================
   Shortcode dates display
   ================================ */

.mga-shortcode-dates {
    display: inline-block;
    color: #333;
}

.mga-shortcode-dates.mga-permanent {
    color: #009444;
    font-weight: 600;
    text-transform: uppercase;
}

/* ================================
   Cart & Checkout display
   ================================ */

.woocommerce-cart-form .mga-date-visite,
.woocommerce-checkout .mga-date-visite {
    color: #009444;
    font-weight: 500;
}

/* ================================
   Animation
   ================================ */

@keyframes mga-pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 148, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 148, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 148, 68, 0); }
}

.mga-dates-trigger:not(.mga-has-selection) {
    animation: mga-pulse 2s infinite;
}

/* ================================
   Validation error
   ================================ */

.mga-dates-error {
    color: #dc3232;
    font-size: 13px;
    margin-top: 8px;
}

.mga-product-dates.mga-has-error {
    border-color: #dc3232;
    background: #fff5f5;
}

.mga-product-dates.mga-has-error .mga-dates-trigger {
    background: #dc3232;
}
