/**
 * Cruise Search Form Styles
 * 
 * Provides styling for the MEI Cruise Search Form shortcode
 * Includes responsive layout, form controls, and interactive states
 * 
 * @package MEI_Travel_Signature
 * @since 1.0.0
 */

/* ==========================================================================
   Form Container
   ========================================================================== */

.mei-cruise-search-form-container {
    /* Fixed width capped by max-width: in a centered flex parent (Elementor)
       the form would otherwise shrink to the width of its longest option. */
    box-sizing: border-box;
    width: 750px;
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
}

.mei-cruise-search-form-container.mei-cruise-search-form--transparent {
    background: transparent;
}

.mei-cruise-search-form-container.mei-cruise-search-form--transparent .mei-form-field label {
    color: #ffffff;
}

.mei-cruise-search-form {
    width: 100%;
}

/* ==========================================================================
   Form Layout - Responsive Grid
   ========================================================================== */

.mei-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

/* ==========================================================================
   Form Fields
   ========================================================================== */

.mei-form-field {
    display: flex;
    flex-direction: column;
}

.mei-form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 0.5rem;
    display: block;
    text-align: left;
}

/* ==========================================================================
   Dropdown Fields (Select)
   ========================================================================== */

.mei-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #333333;
    background-color: #ffffff;
    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 1rem center;
    background-size: 12px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mei-select:hover {
    border-color: #999999;
}

.mei-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.mei-select:disabled {
    background-color: #f5f5f5;
    color: #999999;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================================================
   Date Picker Fields
   ========================================================================== */

.mei-datepicker {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #333333;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23333' d='M5 0v2H3C1.9 2 1 2.9 1 4v9c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2h-2V0h-1v2H6V0H5zm8 13H3V6h10v7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mei-datepicker:hover {
    border-color: #999999;
}

.mei-datepicker:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.mei-datepicker::placeholder {
    color: #999999;
}

/* ==========================================================================
   Search Button
   ========================================================================== */

.mei-form-actions {
    grid-template-columns: 1fr;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.mei-search-button {
    width: 50%;
    min-width: fit-content;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #0066cc;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.mei-search-button:hover {
    background-color: #0052a3;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.mei-search-button:active {
    background-color: #004080;
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
}

.mei-search-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
}

.mei-search-button:disabled,
.mei-search-button.is-loading,
.mei-search-button.is-loading:hover,
.mei-search-button.is-loading:active,
button.button-red.is-loading,
button.button-red.is-loading:hover,
button.button-red.is-loading:active,
button.button-red.is-loading:disabled {
    background-color: #cccccc !important;
    color: #ffffff !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 1;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.mei-form-error {
    display: none;
    padding: 1rem;
    margin-top: 1rem;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    font-size: 0.875rem;
}

.mei-form-error.active {
    display: block;
}

.mei-cruise-search-error {
    padding: 1rem;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    font-size: 0.875rem;
    text-align: center;
}

/* ==========================================================================
   Mobile Responsive Layout
   ========================================================================== */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    .mei-cruise-search-form-container {
        padding: 1.5rem;
    }

    .mei-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .mei-search-button {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
}

/* Mobile (480px) */
@media (max-width: 480px) {
    .mei-cruise-search-form-container {
        padding: 1rem;
        border-radius: 4px;
    }

    .mei-form-field label {
        font-size: 0.8125rem;
    }

    .mei-select,
    .mei-datepicker {
        font-size: 0.9375rem;
        padding: 0.625rem 0.875rem;
    }

    .mei-search-button {
        font-size: 0.9375rem;
        padding: 0.75rem 1.25rem;
    }
}

/* ==========================================================================
   Flatpickr Date Picker Customization
   ========================================================================== */

.flatpickr-calendar {
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.flatpickr-day.selected {
    background-color: #0066cc;
    border-color: #0066cc;
}

.flatpickr-day.selected:hover {
    background-color: #0052a3;
    border-color: #0052a3;
}

.flatpickr-day:hover {
    background-color: #e6f2ff;
    border-color: #e6f2ff;
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.mei-select:focus-visible,
.mei-datepicker:focus-visible,
.mei-search-button:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mei-select,
    .mei-datepicker {
        border-width: 2px;
    }

    .mei-search-button {
        border: 2px solid #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mei-select,
    .mei-datepicker,
    .mei-search-button {
        transition: none;
    }
}
