/**
 * CSS Frontend - Formulaire de réservation
 *
 * @package DSI\Location
 * @since 2.0.0
 */

/* ==========================================================================
   Formulaire de réservation
   ========================================================================== */
.dsi-reservation-form {
    width: 33%;
    padding-right: 1rem;
    margin-bottom: 10px;
    width: 100%;
    background: white;
    padding: 25px;
    border-radius: 6px;
}

.box-resa {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.box-input {
    margin-bottom: 10px;
    align-items: center;
    width: 45%;
}

.box-input label {
    display: block;
}

.select-date {
    width: 180px !important;
}

/* Boutons radio pour les heures */
.radio-btn {
    margin-top: 15px;
    display: flex;
}

.radio-btn input[type="radio"] {
    display: none;
}

.radio-btn label {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    cursor: pointer;
    background: #f9f9f9;
    transition: all 0.2s ease;
}

.radio-btn input[type="radio"] + label {
    margin-right: 15px;
    text-wrap: nowrap;
}

.radio-btn input[type="radio"]:checked + label {
    background: #33c1ba;
    color: white;
    margin-right: 15px;
    text-wrap: nowrap;
}

/* ==========================================================================
   Boutons d'action
   ========================================================================== */
.btn-view-resa {
    font-size: 16px;
    line-height: 1.2 !important;
    font-weight: 700;
    font-style: normal;
    text-transform: none;
    letter-spacing: 0em;
    border-radius: 0.3em;
    padding: 1.0em 2.0em;
    background: #3a8fb7;
    border-color: transparent;
    color: #fff !important;
    margin-left: 1.5rem;
}

.btn-view-resa:hover {
    background-color: #c21917;
}

.btn-resa {
    align-self: flex-end;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    background-color: #00857f !important;
}

.btn-resa:hover {
    background-color: #006961 !important;
}

.dsi-form-actions {
    margin-top: 25px;
}

#dsi-validate-reservation {
    width: 100%;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--dsi-primary) 0%, #005a87 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

#dsi-validate-reservation:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

#dsi-validate-reservation:active {
    transform: translateY(0);
}

#dsi-validate-reservation:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Tarifs
   ========================================================================== */
#dsi-tarifs-title {
    color: #00857f;
}

#dsi-tarifs {
    margin-bottom: 3rem;
}

#dsi-tarifs table tr td {
    border: none;
    text-align: center;
}

#dsi-tarifs p {
    margin: 0;
    color: #33c1ba;
}

#dsi-tarifs table tr:first-child > td {
    color: #33c1ba;
}

#dsi-tarifs table tr:nth-child(2) > td {
    color: #000;
    font-weight: bold;
}

.dsi-tarif-info td {
    display: flex;
    justify-content: flex-start;
}

.dsi-tarifs-headers td,
.dsi-tarifs-prices td {
    width: 50%;
}

.dsi-tarifs-table {
    display: table-cell;
    border-collapse: collapse;
    table-layout: auto;
}

.dsi-tarifs-table td {
    white-space: nowrap;
    padding: .1rem 2rem;
}

.dsi-tarifs-info {
    margin-top: 2rem;
}

/* Grille tarifs (page catégorie) */
.dsi-tarifs-grid {
    background-color: rgba(0, 133, 127, 0.85);
    color: white;
}

.dsi-tarifs-grid tr td {
    border: none;
    padding-inline: 0.8rem;
}

.dsi-tarifs-grid tr:nth-child(2) > td {
    color: #33c1ba;
}

.dsi-tarifs-grid tr:nth-child(2) > td,
.dsi-tarifs-grid tr:nth-child(3) > td {
    text-align: center;
}

/* Délai annulation et tarifs loc */
.delai-annulation,
#tarifs-loc {
    display: none;
}

/* ==========================================================================
   Récapitulatif de prix
   ========================================================================== */
.dsi-price-summary {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    border-left: 4px solid var(--dsi-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dsi-price-summary h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--dsi-primary);
    font-size: 1.2em;
}

#dsi-price-breakdown {
    margin: 15px 0;
}

.dsi-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.dsi-breakdown-item span:first-child {
    color: var(--dsi-text);
}

.dsi-breakdown-item span:last-child {
    font-weight: 600;
    color: var(--dsi-primary);
}

.dsi-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--dsi-primary);
    font-size: 1.3em;
}

.dsi-total-price span {
    color: var(--dsi-primary);
    font-weight: 700;
}

/* ==========================================================================
   Sélecteur d'unité
   ========================================================================== */
.dsi-unit-selector {
    margin-bottom: 20px;
}

.dsi-unit-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dsi-text);
}

.dsi-unit-selector select {
    width: 100%;
    max-width: 350px;
    padding: 10px 15px;
    border: 2px solid var(--dsi-border);
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
}

.dsi-unit-selector select:focus {
    outline: none;
    border-color: var(--dsi-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* ==========================================================================
   Formulaire générique
   ========================================================================== */
.dsi-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dsi-form-col {
    display: flex;
    flex-direction: column;
}

.dsi-form-col label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dsi-text);
}

.dsi-form-col input,
.dsi-form-col select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--dsi-border);
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.dsi-form-col input:focus,
.dsi-form-col select:focus {
    outline: none;
    border-color: var(--dsi-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.dsi-form-col input:invalid {
    border-color: var(--dsi-danger);
}

/* ==========================================================================
   Messages du formulaire
   ========================================================================== */
#dsi-form-messages {
    margin: 20px 0;
}

.dsi-message {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease;
}

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

.dsi-message::before {
    content: '';
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.dsi-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.dsi-message.success::before {
    content: '✓';
    background: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.dsi-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.dsi-message.error::before {
    content: '✕';
    background: #dc3545;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.dsi-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.dsi-message.info::before {
    content: 'ℹ';
    background: #17a2b8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ==========================================================================
   Légende du calendrier
   ========================================================================== */
.dsi-calendar-legend {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.dsi-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dsi-legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Loading State
   ========================================================================== */
.dsi-loading {
    position: relative;
}

.dsi-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--dsi-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Accessibilité
   ========================================================================== */
.dsi-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus {
    outline: 2px solid var(--dsi-primary);
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--dsi-primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .dsi-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .box-resa {
        flex-direction: column;
    }

    .box-input {
        width: 100%;
    }

    .dsi-calendar-legend {
        flex-direction: column;
        gap: 12px;
    }

    .dsi-price-summary {
        padding: 15px;
    }

    .dsi-total-price {
        font-size: 1.1em;
    }

    #dsi-validate-reservation {
        font-size: 16px;
        padding: 12px 20px;
    }

    .calendar-row {
        flex-direction: column;
    }

    .calendar-col,
    .dsi-calendar {
        width: 100%;
    }
}
