/**
 * Reservation Page Styles
 * CSS para página de reserva e detalhes da viagem
 */

/* Plugin-wide font override — força em todas as páginas de reserva */
.r-summary, .r-summary *,
.r-section, .r-section *,
.r-3col-grid, .r-3col-grid *,
.r-pax-form, .r-pax-form *,
.r-loading, .r-loading *,
.r-booking-result, .r-booking-result * {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* Loading spinner */
.r-loading {
    text-align: center !important;
    padding: 40px 20px !important;
}

.r-spinner {
    border: 3px solid #f3f3f3 !important;
    border-top: 3px solid #3498db !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    animation: rspin 1s linear infinite !important;
    margin: 0 auto 20px !important;
    display: block !important;
}

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

.r-loading h3 {
    color: #333 !important;
    font-size: 18px !important;
    margin: 0 0 10px !important;
    font-weight: 600 !important;
}

.r-loading p {
    color: #666 !important;
    font-size: 14px !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}

/* Main sections - Tema do plugin (teal) */
.r-summary, .r-section {
    background: var(--atc-card, #ffffff) !important;
    border: 1px solid var(--atc-border, #e8ecef) !important;
    border-radius: var(--atc-radius, 14px) !important;
    padding: 22px !important;
    margin-bottom: 20px !important;
    box-shadow: var(--atc-shadow, 0 4px 20px rgba(26,35,50,0.08)) !important;
    border-top: 3px solid var(--atc-primary, #1FA3C2) !important;
    transition: box-shadow 0.25s ease !important;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.r-section h4 {
    margin: 0 0 15px !important;
    color: var(--atc-text, #2c3e50) !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    border-bottom: 2px solid var(--atc-bg, #f4f6f9) !important;
    padding-bottom: 10px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Acentos coloridos por tipo de bloco — elegante e simples nos tons do plugin */
.r-section-hotel    { border-top-color: var(--atc-primary, #1FA3C2) !important; }
.r-section-flights   { border-top-color: var(--atc-primary-dark, #1989A3) !important; }
.r-section-included  { border-top-color: var(--atc-success, #27ae60) !important; }
.r-trip-total-section{ border-top-color: var(--atc-warning, #f39c12) !important; }
.r-extras-block      { border-top-color: #8e44ad !important; }
.r-section-cancel    { border-top-color: var(--atc-error, #e74c3c) !important; }
.r-section-payment   { border-top-color: var(--atc-primary, #1FA3C2) !important; }
.r-tp-alts-section   { border-top-color: var(--atc-primary-dark, #1989A3) !important; }

/* Package Summary - Clean white theme */
.r-summary {
    background: #fff !important;
    color: #2c3e50 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin-bottom: 20px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

.r-summary h4 {
    color: #2c3e50 !important;
    margin: 0 0 15px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #e0e0e0 !important;
    padding-bottom: 8px !important;
}

.r-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 12px !important;
}

.r-summary-item {
    background: #ffffff !important;
    padding: 12px !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.r-summary-item.hotel { border-left: 4px solid #3498db; box-shadow: 0 2px 8px rgba(52,152,219,0.2); }
.r-summary-item.rooms { border-left: 4px solid #2980b9; box-shadow: 0 2px 8px rgba(41,128,185,0.2); }
.r-summary-item.room-type { border-left: 4px solid #5dade2; box-shadow: 0 2px 8px rgba(93,173,226,0.2); }
.r-summary-item.board { border-left: 4px solid #1abc9c; box-shadow: 0 2px 8px rgba(26,188,156,0.2); }
.r-summary-item.departure { border-left: 4px solid #3498db; box-shadow: 0 2px 8px rgba(52,152,219,0.2); }
.r-summary-item.airport { border-left: 4px solid #5dade2; box-shadow: 0 2px 8px rgba(93,173,226,0.2); }
.r-summary-item.nights { border-left: 4px solid #2980b9; box-shadow: 0 2px 8px rgba(41,128,185,0.2); }
.r-summary-item.adults { border-left: 4px solid #1abc9c; box-shadow: 0 2px 8px rgba(26,188,156,0.2); }
.r-summary-item.children { border-left: 4px solid #5dade2; box-shadow: 0 2px 8px rgba(93,173,226,0.2); }
.r-summary-item.ages { border-left: 4px solid #2980b9; box-shadow: 0 2px 8px rgba(41,128,185,0.2); }
.r-summary-item.distribution { border-left: 4px solid #3498db; box-shadow: 0 2px 8px rgba(52,152,219,0.2); }

.r-summary-item .label {
    font-size: 12px !important;
    color: #7f8c8d !important;
    margin-bottom: 4px !important;
    font-weight: 600 !important;
}

.r-summary-item .value {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #2c3e50 !important;
}

/* 3-column grid: Voos / Hotel / Serviços */
.r-3col-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .r-3col-grid {
        grid-template-columns: 1fr;
    }
}

/* Hotel section */
.r-hotel-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.r-hotel-image .fallback {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #e1e4e8, #b2bec3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: 6px;
    margin-bottom: 10px;
    font-style: italic;
}

.r-hotel-info h5 {
    margin: 0 0 8px;
    font-size: 16px;
}

.r-hotel-stars {
    color: #f1c40f;
    margin-bottom: 8px;
}

.r-hotel-desc {
    font-size: 12px;
    color: #5a6c7d;
    max-height: 80px;
    overflow: hidden;
}

.r-hotel-desc.expanded {
    max-height: none;
    overflow: visible;
}

.r-hotel-toggle {
    background: none;
    border: none;
    color: var(--atc-primary, #1FA3C2);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    margin-top: 4px;
    text-align: left;
    display: block;
}

/* Flight cards */
.r-flight-card {
    background: #f9fafb;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.r-flight-card .route {
    font-weight: 600;
}

.r-flight-card .meta {
    color: #7f8c8d;
    font-size: 11px;
    margin-top: 4px;
}

/* Services list */
.r-services-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.r-services-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.r-services-list li:before {
    content: "\2713 ";
    color: #27ae60;
    font-weight: 700;
}

.r-services-list li:last-child {
    border-bottom: 0;
}

/* Optional items */
.r-optional {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    margin-bottom: 8px;
}

/* Botão "Ver mais" (excursões / extras opcionais) */
.r-extras-toggle {
    text-align: center;
    margin-top: 10px;
}

.r-extras-toggle button {
    background: #f0fafd;
    border: 1px solid var(--atc-primary, #1FA3C2);
    color: var(--atc-primary-dark, #1989A3);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
}

.r-extras-toggle button:hover {
    background: var(--atc-primary, #1FA3C2);
    color: #fff;
}

/* Cancellation policies - Clean theme */
.r-cancellation-flexible {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #22c55e;
    border-radius: 6px;
    padding: 12px 15px;
}

.r-cancellation-flexible p {
    margin: 0;
    font-weight: 600;
}

.r-cancellation-cards {
    background: transparent;
    color: #2c3e50;
    border-radius: 0;
    padding: 0;
}

.r-cancellation-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

.r-cancellation-card:last-child {
    margin-bottom: 0;
}

.r-cancellation-table {
    background: transparent;
    color: #2c3e50;
    border-radius: 0;
    padding: 0;
}

.r-cancellation-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.r-cancellation-table th {
    background: #f9fafb;
    color: #555;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.r-cancellation-table td {
    padding: 8px 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
}

.r-cancellation-table td.amount {
    color: #c0392b;
    font-weight: 700;
}

/* Payment rows - text left, value right */
.r-payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.r-payment-row:last-child {
    border-bottom: 0;
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 2px solid #e0e0e0;
}

.r-payment-row .label {
    color: #555;
    text-align: left;
}

.r-payment-row span:last-child {
    text-align: right;
    font-weight: 600;
    color: #2c3e50;
}

/* Passenger forms */
.r-pax-form {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.r-pax-form h5 {
    margin: 0 0 15px;
    color: var(--atc-text, #2c3e50);
    font-size: 16px;
    border-bottom: 2px solid var(--atc-primary, #1FA3C2);
    padding-bottom: 8px;
}

.r-pax-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.r-pax-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.r-pax-form input, .r-pax-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
}

.r-pax-form input:focus, .r-pax-form select:focus {
    outline: none;
    border-color: var(--atc-primary, #1FA3C2);
    box-shadow: 0 0 0 2px rgba(31,163,194,0.18);
}

/* References section - Theme from search results */
.r-references {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin-top: 20px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.r-references h5 {
    margin: 0 0 15px !important;
    color: #333 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #e0e0e0 !important;
    padding-bottom: 8px !important;
}

.r-references p {
    margin: 8px 0 !important;
    font-size: 14px !important;
    color: #666 !important;
    line-height: 1.5 !important;
}

.r-references strong {
    color: #333 !important;
    font-weight: 700 !important;
    font-size: 15px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .r-summary-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .r-summary {
        padding: 20px;
    }
    
    .r-summary h4 {
        font-size: 18px;
    }
    
    .r-3col-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Bloco por passageiro (adulto/criança) */
.r-pax-block {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px 16px 10px;
    margin-bottom: 12px;
    background: #fff;
    width: 100%;
}

.r-pax-block-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--atc-primary-dark, #1989A3);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

/* Colunas do formulário por defeito (mobile first) */
.r-pax-col3,
.r-pax-col2 {
    width: 100%;
    box-sizing: border-box;
}

.r-pax-col3 label,
.r-pax-col2 label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.r-pax-col3 input,
.r-pax-col3 select,
.r-pax-col2 input,
.r-pax-col2 select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}

.r-pax-col3 input:focus,
.r-pax-col3 select:focus,
.r-pax-col2 input:focus,
.r-pax-col2 select:focus {
    outline: none;
    border-color: var(--atc-primary, #1FA3C2);
    box-shadow: 0 0 0 2px rgba(31,163,194,0.18);
}

/* Passenger form responsive layout */
@media (min-width: 768px) {
    .r-pax-form {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .r-pax-col3 {
        flex: 0 0 calc(33.333% - 7px);
        min-width: 0;
    }

    .r-pax-col2 {
        flex: 0 0 calc(50% - 5px);
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .r-pax-col3,
    .r-pax-col2 {
        width: 100%;
    }
}

/* ── Layout principal: Hotel (esquerda) | Voos + Incluído + Total/CTAs (direita) ── */
.r-top-layout {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    align-items: flex-start !important;
    margin-bottom: 0 !important;
    box-sizing: border-box !important;
}

.r-top-hotel {
    flex: 0 0 auto !important;
    width: 300px !important;
    min-width: 220px !important;
    max-width: 340px !important;
}

.r-top-hotel .r-section {
    height: 100% !important;
    box-sizing: border-box !important;
}

.r-top-right {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

.r-top-right .r-section {
    margin-bottom: 16px !important;
}

/* Bloco Total da Viagem + CTAs — 3ª coluna do r-top-layout, largura mínima */
.r-trip-total-section {
    flex: 0 0 280px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 280px !important;
    min-width: 260px !important;
    max-width: 300px !important;
    padding: 18px 22px !important;
    margin-bottom: 0 !important;
    box-sizing: border-box !important;
}

.r-trip-total-section h4 {
    margin: 0 0 4px !important;
}

.r-total-big .value,
.r-total-big span:last-child {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: var(--atc-primary-dark, #1989A3) !important;
}

/* ── Botões: idênticos ao botão "Procurar" da pesquisa inicial ── */
.r-btn-primary,
.r-cta-continue {
    width: 100% !important;
    height: 48px !important;
    background: linear-gradient(135deg, var(--atc-primary, #1FA3C2), var(--atc-primary-dark, #1989A3)) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: transform 0.2s, box-shadow 0.25s !important;
    box-shadow: 0 4px 15px rgba(31,163,194,0.4) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-top: 4px !important;
}

.r-btn-primary:hover,
.r-cta-continue:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(31,163,194,0.5) !important;
}

.r-btn-primary:active,
.r-cta-continue:active { transform: translateY(0) !important; }

.r-btn-secondary {
    width: 100% !important;
    height: 44px !important;
    background: #fff !important;
    border: 2px solid var(--atc-primary, #1FA3C2) !important;
    border-radius: 10px !important;
    color: var(--atc-primary-dark, #1989A3) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: background 0.2s, color 0.2s, transform 0.2s !important;
    margin-top: 10px !important;
}

.r-btn-secondary:hover {
    background: var(--atc-bg, #e9f8fb) !important;
    transform: translateY(-1px) !important;
}

.r-btn-proposal {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    height: 42px !important;
    background: #fff !important;
    border: 2px solid #f39c12 !important;
    border-radius: 10px !important;
    color: #d68910 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: background 0.2s, color 0.2s, transform 0.2s !important;
}

.r-btn-proposal:hover {
    background: #fef5e7 !important;
    transform: translateY(-1px) !important;
}

/* ── Bloco Extras: 2 sub-colunas internas (Adicionais | Excursões) ── */
.r-extras-block h4 {
    margin: 0 0 14px !important;
}

.r-extras-2col {
    display: flex !important;
    gap: 20px !important;
    align-items: flex-start !important;
}

.r-extras-col {
    flex: 1 1 0 !important;
    min-width: 0 !important;
}

.r-extras-col h5 {
    margin: 0 0 10px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .5px !important;
    color: #5d6d7e !important;
    border-bottom: 1px solid #e0e0e0 !important;
    padding-bottom: 6px !important;
}

/* ── Responsive do novo layout ──────────────────────────────── */

/* Tablet / small desktop: empilhar colunas principais */
@media (max-width: 900px) {
    .r-top-layout,
    .r-extras-2col {
        flex-direction: column !important;
    }

    .r-top-hotel {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .r-top-right {
        width: 100% !important;
        flex: none !important;
    }

    .r-trip-total-section {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .r-extras-col {
        width: 100% !important;
    }
}

/* Mobile: ajustes adicionais para ecrãs pequenos */
@media (max-width: 600px) {
    .r-trip-total-section {
        width: 100% !important;
        max-width: 100% !important;
        gap: 8px !important;
    }

    .r-cta-continue {
        padding: 15px !important;
        font-size: 16px !important;
    }

    .r-btn-proposal {
        padding: 12px !important;
        font-size: 14px !important;
    }

    .r-total-big span:last-child {
        font-size: 20px !important;
    }

    .r-top-right .r-section {
        margin-bottom: 12px !important;
    }
}

/* ── TravelPlan: alternativas de voos na página de reserva ── */
.r-tp-alts-section h4 {
    margin: 0 0 12px !important;
}

.r-tp-alts-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.r-tp-alt-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 10px 14px !important;
    background: #f8f9fa !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    transition: border-color 0.2s, background 0.2s !important;
}

.r-tp-alt-row.r-tp-alt-selected {
    background: var(--atc-bg, #e9f8fb) !important;
    border-color: var(--atc-primary, #1FA3C2) !important;
}

.r-tp-alt-info {
    flex: 1 !important;
    font-size: 13px !important;
    color: #2c3e50 !important;
    line-height: 1.4 !important;
}

.r-tp-alt-action {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 6px !important;
    min-width: 110px !important;
}

.r-tp-alt-price {
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 4px !important;
    padding: 2px 7px !important;
}

.r-tp-alt-sup {
    background: #fdecea !important;
    color: #c0392b !important;
}

.r-tp-alt-inc {
    background: #eafaf1 !important;
    color: #27ae60 !important;
}

@media (max-width: 600px) {
    .r-tp-alt-row {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .r-tp-alt-action {
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important;
        justify-content: space-between !important;
    }
}
