/**
 * Shared Booking Form Components
 * Reusable UI components for all booking modules (Ferry, Event, Dining, etc.)
 * Color theme: Orange #FF6B35 / Green #00A651
 *
 * Components:
 *   Layout:       .form-section, .section-label
 *   Date:         .date-button, .hidden-datepicker
 *   Select:       .form-select
 *   Card Select:  .seat-class-group, .btn-seat-class
 *   Passengers:   .passenger-section, .passenger-list, .passenger-row,
 *                 .passenger-info, .passenger-name, .passenger-price
 *   Quantity:     .quantity-control, .qty-btn, .qty-display
 *   Bottom Bar:   .booking-bottom-bar, .bottom-bar-content, .total-section,
 *                 .total-label, .total-price, .price-note, .promo-text-section,
 *                 .action-buttons, .btn-book-now, .btn-cta-red, .btn-enquiry
 *   Alert:        .alert-message, .close-alert
 *   Animations:   slide-up, fade, slideInRight, priceChange, buttonPulse
 */

/* ============================================
   Vue Cloak
   ============================================ */
[v-cloak] {
    display: none;
}

/* ============================================
   Form Sections
   ============================================ */
.form-section {
    margin-bottom: 20px;
}

.section-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.section-label i {
    margin-right: 6px;
    color: #FF6B35;
}

/* ============================================
   Select Dropdowns
   ============================================ */
.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    color: #333;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-select:hover {
    border-color: #FF6B35;
}

.form-select:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-select option:disabled {
    color: #999;
}

/* ============================================
   Card Selection (Seat Class / Zone)
   ============================================ */
.seat-class-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-seat-class {
    flex: 1 0 calc(25% - 10px);  /* max 4 per row, wraps when >4 */
    min-width: 0;
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.btn-seat-class:hover {
    border-color: #FF6B35;
    background: #fff5f2;
}

.btn-seat-class.active {
    border-color: #FF6B35;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-seat-class:active {
    transform: scale(0.97);
}

/* 5+ buttons: disable flex-grow so wrapped items keep same width as others */
.btn-seat-class:first-child:nth-last-child(n+5),
.btn-seat-class:first-child:nth-last-child(n+5) ~ .btn-seat-class {
    flex-grow: 0;
}

/* ============================================
   Date Buttons
   ============================================ */
.date-button {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 12px;
    font-size: 15px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.date-button:hover {
    border-color: #FF6B35;
    background: #fff5f2;
}

.date-button.selected {
    border-color: #FF6B35;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
    color: white;
}

.date-button .placeholder {
    color: #999;
}

.date-button.selected .placeholder,
.date-button.selected .date-text {
    color: white;
}

.date-button i {
    font-size: 16px;
}

.hidden-datepicker {
    position: absolute;
    visibility: hidden;
    height: 1px;
    width: 1px;
}

/* ============================================
   Selected Info Display (shared: ferry trip info, event tickets summary)
   ============================================ */
.price-type-display {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid #dee2e6;
}

.price-type-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.price-type-row:not(:last-child) {
    border-bottom: 1px dashed #dee2e6;
    margin-bottom: 6px;
    padding-bottom: 12px;
}

.price-type-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    min-width: 60px;
}

.price-type-label i {
    margin-right: 4px;
    color: #FF6B35;
}

/* ============================================
   Passenger Section
   ============================================ */
.passenger-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.passenger-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.passenger-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.passenger-info {
    flex: 1;
}

.passenger-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.passenger-price {
    display: block;
    font-size: 14px;
    color: #00A651;
    font-weight: 600;
}

/* ============================================
   Quantity Controls (Circular Buttons)
   ============================================ */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.qty-btn:hover:not(:disabled) {
    border-color: #FF6B35;
    background: #fff5f2;
    transform: scale(1.1);
}

.qty-btn.plus {
    border-color: #00A651;
    background: #00A651;
    color: white;
}

.qty-btn.plus:hover {
    background: #00C853;
    border-color: #00C853;
}

.qty-btn.plus:active {
    animation: buttonPulse 0.2s ease;
}

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

.qty-display {
    min-width: 32px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* ============================================
   Bottom Bar (Fixed)
   ============================================ */
.booking-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    z-index: 1000;
    border-top: 1px solid #e0e0e0;
}

.booking-bottom-bar.no-info {
    background: linear-gradient(to right, #fff8f5 0%, #ffffff 100%);
}

.booking-bottom-bar.no-info .bottom-bar-content {
    justify-content: space-between;
}

.promo-text-section {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 900;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

.btn-cta-red {
    background: #e53935 !important;
    color: white !important;
    border: none !important;
    padding: 14px 32px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3) !important;
}

.btn-cta-red:hover {
    background: #c62828 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(229, 57, 53, 0.4) !important;
}

.bottom-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.total-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-label {
    font-size: 13px;
    color: #666;
}

.total-price {
    font-size: 28px;
    font-weight: 700;
    color: #00A651;
    transition: all 0.3s ease;
}

.price-note {
    font-size: 11px;
    color: #999;
    font-weight: normal;
    line-height: 1.3;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.btn-enquiry {
    padding: 14px 24px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-enquiry:hover {
    border-color: #FF6B35;
    background: #fff5f2;
}

.btn-book-now {
    padding: 14px 32px;
    border: none;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
    color: white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-book-now:hover:not(:disabled) {
    background: linear-gradient(135deg, #FF8C42 0%, #FFA05C 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.btn-book-now:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Alert Messages
   ============================================ */
.alert-message {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
}

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

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

.alert-message i {
    font-size: 20px;
}

.close-alert {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.close-alert:hover {
    opacity: 1;
}

/* ============================================
   Animations
   ============================================ */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-up-enter-active,
.slide-up-leave-active {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.slide-up-enter,
.slide-up-leave-to {
    transform: translateY(100%);
    opacity: 0;
}

.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.3s ease;
}

.fade-enter,
.fade-leave-to {
    opacity: 0;
}

@keyframes priceChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); color: #28a745; }
    100% { transform: scale(1); }
}

.total-price.updating {
    animation: priceChange 0.3s ease;
}

@keyframes buttonPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ============================================
   DateRangePicker Fix
   ============================================ */
.daterangepicker {
    z-index: 99999 !important;
    position: absolute !important;
}

.daterangepicker.show-calendar {
    display: block;
}

/* ============================================
   Responsive — Shared Components
   ============================================ */
@media (max-width: 768px) {
    .bottom-bar-content {
        flex-direction: column;
        gap: 12px;
    }

    .action-buttons {
        width: 100%;
        flex-direction: column;
    }

    .btn-enquiry,
    .btn-book-now {
        width: 100%;
        justify-content: center;
    }

    .total-section {
        width: 100%;
        text-align: center;
    }

    .promo-text-section {
        width: 100%;
        text-align: center;
        justify-content: center;
        font-size: 15px;
    }

    .btn-cta-red {
        width: 100% !important;
        justify-content: center !important;
    }

    .alert-message {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .passenger-row {
        padding: 12px;
    }

    .qty-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .qty-display {
        font-size: 16px;
    }
}

/* ============================================
   Print — Shared Components
   ============================================ */
@media print {
    .booking-bottom-bar,
    .alert-message {
        display: none !important;
    }
}
