/**
 * Formulaire de Réservation - Styles
 * VERSION FINALE AVEC CUSTOM SELECT
 * 
 * Fichier: wp-content/themes/[kadence-child]/css/form-reservation.css
 */

/* ========================================================================== */
/* VARIABLES ET RESET */
/* ========================================================================== */

:root {
    --color-primary: #ffd700;
    --color-primary-dark: #ffb700;
    --color-text: #333;
    --color-text-light: #666;
    --color-border: #ddd;
    --color-error: #dc3545;
    --color-success: #28a745;
    --color-background: #f9f9f9;
    --color-white: #fff;
    --spacing-unit: 8px;
    --border-radius: 4px;
    --transition-speed: 0.3s;
}

.form-reservation-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 3);
}

/* ========================================================================== */
/* FORMULAIRE PRINCIPAL */
/* ========================================================================== */

.form-reservation {
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Messages */
.form-messages {
    padding: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius);
    border-left: 4px solid;
    animation: slideDown 0.3s ease-out;
}

.form-messages.alert-error {
    background-color: #f8d7da;
    border-color: var(--color-error);
    color: #721c24;
}

.form-messages.alert-success {
    background-color: #d4edda;
    border-color: var(--color-success);
    color: #155724;
}

.form-messages p {
    margin: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sections */
.form-section {
    border: none;
    padding: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
    background: var(--color-background);
    border-radius: var(--border-radius);
}

.form-section:last-of-type {
    margin-bottom: 0;
}

.form-section legend {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a5f7a;
    padding: 0;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: calc(var(--spacing-unit) * 1);
}

/* ========================================================================== */
/* GROUPES DE CHAMPS */
/* ========================================================================== */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    color: var(--color-text);
    font-size: 0.95rem;
}

.form-group label .required {
    color: var(--color-error);
    margin-left: 2px;
}

/* ========================================================================== */
/* CHAMPS DE FORMULAIRE */
/* ========================================================================== */

.form-control {
    padding: calc(var(--spacing-unit) * 1.25) var(--spacing-unit) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--border-radius) !important;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--color-white) !important;
    color: var(--color-text) !important;
    transition: all var(--transition-speed) ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1) !important;
}

.form-control:disabled {
    background-color: #f0f0f0 !important;
    color: var(--color-text-light) !important;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Select */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(var(--spacing-unit) * 0.75) center;
    background-size: 1.25rem;
    padding-right: calc(var(--spacing-unit) * 3.5);
}

/* Phone Input */
.phone-input-wrapper {
    display: flex;
    gap: var(--spacing-unit);
    align-items: center;
}

.phone-country-code {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: calc(var(--spacing-unit) * 1.25) var(--spacing-unit);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    white-space: nowrap;
}

.phone-country-code img {
    width: 20px;
    height: auto;
}

.phone-input-wrapper .form-control {
    flex: 1;
}

/* ========================================================================== */
/* MESSAGES D'ERREUR */
/* ========================================================================== */

.form-error {
    display: none;
    color: var(--color-error);
    font-size: 0.85rem;
    margin-top: calc(var(--spacing-unit) * 0.5);
    animation: slideDown 0.2s ease-out;
}

.form-control:invalid:not(:placeholder-shown) {
    border-color: var(--color-error) !important;
}

.form-control:invalid:not(:placeholder-shown)~.form-error {
    display: block;
}

/* ========================================================================== */
/* CHECKBOX */
/* ========================================================================== */

.checkbox-group {
    flex-direction: row;
    align-items: flex-start;
}

.checkbox-label {
    display: flex;
    gap: calc(var(--spacing-unit) * 0.75);
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 4px;
    cursor: pointer;
    width: auto;
}

.checkbox-text {
    font-size: 0.9rem;
    color: var(--color-text-light);
    line-height: 1.4;
}

/* ========================================================================== */
/* COMPTEUR CARACTÈRES */
/* ========================================================================== */

.char-count {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: calc(var(--spacing-unit) * 0.5);
    text-align: right;
}

/* ========================================================================== */
/* BOUTONS */
/* ========================================================================== */

.form-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-unit);
    padding: calc(var(--spacing-unit) * 2);
    padding-top: calc(var(--spacing-unit) * 3);
    border-top: 1px solid var(--color-border);
}

.btn {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-unit);
    justify-content: center;
    text-decoration: none;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: #000;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================================================== */
/* MODAL */
/* ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-unit);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-success);
}

.modal-body {
    padding: calc(var(--spacing-unit) * 2);
}

.modal-body p {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    color: var(--color-text-light);
    line-height: 1.6;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-subtitle {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: calc(var(--spacing-unit) * 2.5) !important;
}

.modal-info {
    background: #f0f8ff;
    padding: calc(var(--spacing-unit) * 1.5);
    border-radius: var(--border-radius);
    border-left: 4px solid #1a5f7a;
    margin-top: calc(var(--spacing-unit) * 2);
}

.modal-info p {
    font-size: 0.9rem;
    margin-bottom: calc(var(--spacing-unit));
}

.modal-info p:last-child {
    margin-bottom: 0;
}

.modal-info em {
    color: #1a5f7a;
    font-style: italic;
}

/* Contact Box */
.entreprise-contact-box {
    background: #e7f3ff;
    padding: calc(var(--spacing-unit) * 1.5);
    border-radius: var(--border-radius);
    margin: calc(var(--spacing-unit) * 2) 0;
    border-left: 4px solid #1a5f7a;
}

.entreprise-contact-box h4 {
    color: #1a5f7a;
    margin: 0 0 calc(var(--spacing-unit)) 0;
    font-size: 1rem;
}

.entreprise-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-text);
    margin-bottom: calc(var(--spacing-unit));
}

.entreprise-detail {
    margin-bottom: calc(var(--spacing-unit) * 0.75);
}

.entreprise-detail .label {
    font-weight: 600;
    color: #1a5f7a;
}

.entreprise-detail a {
    color: #1a5f7a;
    text-decoration: none;
}

.entreprise-detail a:hover {
    text-decoration: underline;
}

.modal-footer {
    padding: calc(var(--spacing-unit) * 2);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-unit);
}

.modal-close {
    position: absolute;
    top: calc(var(--spacing-unit));
    right: calc(var(--spacing-unit));
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-light);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-speed);
}

.modal-close:hover {
    background: var(--color-background);
    color: var(--color-text);
}

/* ========================================================================== */
/* RESPONSIVE */
/* ========================================================================== */

@media (max-width: 600px) {
    .form-reservation-wrapper {
        padding: var(--spacing-unit);
    }

    .form-section {
        padding: calc(var(--spacing-unit) * 1.5);
    }

    .form-section legend {
        font-size: 1.1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .modal-content {
        max-width: 90%;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding: var(--spacing-unit);
    }
}

/* ========================================================================== */
/* CUSTOM COUNTRY SELECT AVEC DRAPEAUX SVG */
/* ========================================================================== */

.custom-country-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-country-select {
    position: relative;
    width: 100%;
}

.custom-country-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(var(--spacing-unit) * 1.25) var(--spacing-unit);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-white);
    cursor: pointer;
    min-height: 44px;
    user-select: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.custom-country-selected:hover {
    border-color: #999;
}

.custom-country-selected:focus,
.custom-country-selected.focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.country-flag {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.country-dial {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    flex: 1;
    color: var(--color-text);
}

.chevron-down {
    font-size: 12px;
    color: #666;
    transition: transform var(--transition-speed);
    margin-left: auto;
    flex-shrink: 0;
}

.custom-country-selected.open .chevron-down {
    transform: rotate(180deg);
}

/* Dropdown */
.custom-country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    animation: slideDown 0.15s ease-out;
}

.country-search {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 10px;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    background: var(--color-white);
    outline: none;
    box-sizing: border-box;
}

.country-search:focus {
    background: var(--color-background);
}

.country-search::placeholder {
    color: #999;
}

.country-list {
    display: flex;
    flex-direction: column;
}

/* Options */
.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.country-option:last-child {
    border-bottom: none;
}

.country-option:hover {
    background-color: var(--color-background);
}

.country-option.selected {
    background-color: #e8f1ff;
    border-left: 3px solid var(--color-primary);
    padding-left: 7px;
}

.option-flag {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.option-text {
    font-size: 14px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Custom Select */
@media (max-width: 768px) {
    .custom-country-dropdown {
        max-height: 250px;
    }

    .country-option {
        padding: 10px 8px;
    }

    .option-flag {
        width: 20px;
        height: 14px;
    }

    .option-text {
        font-size: 13px;
    }

    .country-dial {
        font-size: 13px;
    }
}