/**
 * TourSure Flight - Mobile Filter Styles
 * File: toursure-mobile-filter.css
 * ไฟล์ CSS แยกสำหรับ Mobile Filter FAB และ Panel
 */

/* ===========================
   CSS Variables (inherit from main)
   =========================== */
:root {
    --tsflt-mobile-primary: #5b21b6;
    --tsflt-mobile-primary-dark: #4c1d95;
    --tsflt-mobile-gray-50: #f9fafb;
    --tsflt-mobile-gray-100: #f3f4f6;
    --tsflt-mobile-gray-200: #e5e7eb;
    --tsflt-mobile-gray-300: #d1d5db;
    --tsflt-mobile-gray-400: #9ca3af;
    --tsflt-mobile-gray-500: #6b7280;
    --tsflt-mobile-gray-600: #4b5563;
    --tsflt-mobile-gray-700: #374151;
    --tsflt-mobile-gray-800: #1f2937;
    --tsflt-mobile-gray-900: #111827;
}

/* ===========================
   FAB - Hidden on Desktop
   =========================== */
.tsflt-filter-fab-flt7k3 {
    display: none;
}

/* ===========================
   Mobile Filter Panel - Hidden on Desktop
   =========================== */
.tsflt-mobile-filter-panel-flt7k3 {
    display: none;
}

/* ===========================
   Mobile Filter Overlay - Hidden on Desktop
   =========================== */
.tsflt-mobile-filter-overlay-flt7k3 {
    display: none;
}

/* ===========================
   FAB Text - Hidden by default
   =========================== */
.tsflt-fab-text-flt7k3 {
    display: none;
}

/* ===========================
   Mobile Styles (768px and below)
   =========================== */
@media (max-width: 768px) {

    /* ซ่อน Filter Row 2 และ 3 บน Mobile */
    .tsflt-filters-flt7k3 .tsflt-filter-row-flt7k3:nth-child(2),
    .tsflt-filters-flt7k3 .tsflt-filter-row-flt7k3:nth-child(3) {
        display: none !important;
    }

    /* ===========================
       FAB Button
       =========================== */
    .tsflt-filter-fab-flt7k3 {
        display: flex;
        position: fixed;
        bottom: 24px;
        right: 24px;
        min-width: 56px;
        height: 56px;
        padding: 0 20px;
        background: linear-gradient(135deg, var(--tsflt-mobile-primary) 0%, var(--tsflt-mobile-primary-dark) 100%);
        color: white;
        border: none;
        border-radius: 28px;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        box-shadow: 0 4px 20px rgba(91, 33, 182, 0.4),
                    0 2px 8px rgba(0, 0, 0, 0.1);
        z-index: 9990;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        font-family: inherit;
    }

    .tsflt-filter-fab-flt7k3:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 24px rgba(91, 33, 182, 0.5),
                    0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .tsflt-filter-fab-flt7k3:active {
        transform: translateY(0) scale(0.98);
    }

    .tsflt-filter-fab-flt7k3.active {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.8);
    }

    .tsflt-filter-fab-flt7k3 svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .tsflt-fab-text-flt7k3 {
        display: inline;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
    }

    /* ===========================
       Mobile Filter Overlay
       =========================== */
    .tsflt-mobile-filter-overlay-flt7k3 {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 99998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .tsflt-mobile-filter-overlay-flt7k3.active {
        opacity: 1;
        visibility: visible;
    }

    /* ===========================
       Mobile Filter Panel
       =========================== */
    .tsflt-mobile-filter-panel-flt7k3 {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.25);
        z-index: 99999;
        max-height: 85vh;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }

    .tsflt-mobile-filter-panel-flt7k3.active {
        transform: translateY(0);
    }

    /* Panel Drag Handle */
    .tsflt-mobile-filter-panel-flt7k3::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--tsflt-mobile-gray-300);
        border-radius: 2px;
    }

    /* ===========================
       Panel Header
       =========================== */
    .tsflt-mobile-filter-header-flt7k3 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 24px 20px 16px;
        border-bottom: 1px solid var(--tsflt-mobile-gray-200);
        flex-shrink: 0;
    }

    .tsflt-mobile-filter-header-flt7k3 h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: var(--tsflt-mobile-gray-900);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .tsflt-mobile-filter-header-flt7k3 h3::before {
        content: '';
        display: inline-block;
        width: 4px;
        height: 20px;
        background: linear-gradient(180deg, var(--tsflt-mobile-primary), var(--tsflt-mobile-primary-dark));
        border-radius: 2px;
    }

    .tsflt-mobile-filter-close-flt7k3 {
        width: 40px;
        height: 40px;
        background: var(--tsflt-mobile-gray-100);
        border: none;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .tsflt-mobile-filter-close-flt7k3:hover {
        background: var(--tsflt-mobile-gray-200);
    }

    .tsflt-mobile-filter-close-flt7k3:active {
        transform: scale(0.95);
    }

    .tsflt-mobile-filter-close-flt7k3 svg {
        width: 20px;
        height: 20px;
        color: var(--tsflt-mobile-gray-600);
    }

    /* ===========================
       Panel Body
       =========================== */
    .tsflt-mobile-filter-body-flt7k3 {
        padding: 20px;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    /* ===========================
       Filter Groups
       =========================== */
    .tsflt-mobile-filter-group-flt7k3 {
        margin-bottom: 24px;
    }

    .tsflt-mobile-filter-group-flt7k3:last-child {
        margin-bottom: 0;
    }

    /* Labels */
    .tsflt-mobile-filter-group-flt7k3 > label {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        font-weight: 600;
        color: var(--tsflt-mobile-gray-700);
        margin-bottom: 10px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .tsflt-mobile-filter-group-flt7k3 > label::before {
        content: '';
        display: inline-block;
        width: 8px;
        height: 8px;
        background: var(--tsflt-mobile-primary);
        border-radius: 50%;
        opacity: 0.6;
    }

    /* ===========================
       Select Inputs
       =========================== */
    .tsflt-mobile-filter-select-flt7k3 {
        width: 100%;
        padding: 14px 16px;
        padding-right: 44px;
        border: 2px solid var(--tsflt-mobile-gray-200);
        border-radius: 12px;
        font-size: 15px;
        font-weight: 500;
        background-color: white;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' 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 14px center;
        background-size: 18px;
        color: var(--tsflt-mobile-gray-900);
        cursor: pointer;
        transition: all 0.2s ease;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .tsflt-mobile-filter-select-flt7k3:focus {
        outline: none;
        border-color: var(--tsflt-mobile-primary);
        box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.1);
    }

    .tsflt-mobile-filter-select-flt7k3:hover {
        border-color: var(--tsflt-mobile-gray-300);
    }

    /* ===========================
       Text/Number/Date Inputs
       =========================== */
    .tsflt-mobile-filter-input-flt7k3 {
        width: 100%;
        padding: 14px 16px;
        border: 2px solid var(--tsflt-mobile-gray-200);
        border-radius: 12px;
        font-size: 15px;
        font-weight: 500;
        background: white;
        color: var(--tsflt-mobile-gray-900);
        transition: all 0.2s ease;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .tsflt-mobile-filter-input-flt7k3:focus {
        outline: none;
        border-color: var(--tsflt-mobile-primary);
        box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.1);
    }

    .tsflt-mobile-filter-input-flt7k3:hover {
        border-color: var(--tsflt-mobile-gray-300);
    }

    .tsflt-mobile-filter-input-flt7k3::placeholder {
        color: var(--tsflt-mobile-gray-400);
        font-weight: 400;
    }

    /* Date input specific */
    input[type="date"].tsflt-mobile-filter-input-flt7k3 {
        position: relative;
    }

    input[type="date"].tsflt-mobile-filter-input-flt7k3::-webkit-calendar-picker-indicator {
        background: transparent;
        bottom: 0;
        color: transparent;
        cursor: pointer;
        height: auto;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        width: auto;
    }

    /* Number input - hide spinners */
    input[type="number"].tsflt-mobile-filter-input-flt7k3::-webkit-outer-spin-button,
    input[type="number"].tsflt-mobile-filter-input-flt7k3::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    input[type="number"].tsflt-mobile-filter-input-flt7k3 {
        -moz-appearance: textfield;
    }

    /* ===========================
       Date Range Container
       =========================== */
    .tsflt-mobile-date-range-flt7k3 {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .tsflt-mobile-date-range-flt7k3 .tsflt-mobile-filter-input-flt7k3 {
        flex: 1;
    }

    .tsflt-mobile-date-separator-flt7k3 {
        color: var(--tsflt-mobile-gray-400);
        font-size: 18px;
        font-weight: 500;
        flex-shrink: 0;
    }

    /* ===========================
       Price Range Container
       =========================== */
    .tsflt-mobile-price-range-flt7k3 {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .tsflt-mobile-price-range-flt7k3 .tsflt-mobile-filter-input-flt7k3 {
        flex: 1;
    }

    .tsflt-mobile-price-separator-flt7k3 {
        color: var(--tsflt-mobile-gray-400);
        font-size: 18px;
        font-weight: 500;
        flex-shrink: 0;
    }

    /* ===========================
       Panel Footer
       =========================== */
    .tsflt-mobile-filter-footer-flt7k3 {
        display: flex;
        gap: 12px;
        padding: 16px 20px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--tsflt-mobile-gray-200);
        background: var(--tsflt-mobile-gray-50);
        flex-shrink: 0;
    }

    .tsflt-mobile-filter-footer-flt7k3 .tsl-btn {
        flex: 1;
        padding: 16px 24px;
        font-size: 15px;
        font-weight: 600;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        border: none;
    }

    .tsflt-mobile-filter-footer-flt7k3 .tsl-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Reset Button */
    .tsflt-mobile-reset-btn-flt7k3 {
        background: white !important;
        color: var(--tsflt-mobile-gray-700) !important;
        border: 2px solid var(--tsflt-mobile-gray-300) !important;
    }

    .tsflt-mobile-reset-btn-flt7k3:hover {
        background: var(--tsflt-mobile-gray-50) !important;
        border-color: var(--tsflt-mobile-gray-400) !important;
    }

    .tsflt-mobile-reset-btn-flt7k3:active {
        transform: scale(0.98);
    }

    /* Apply/Search Button */
    .tsflt-mobile-apply-btn-flt7k3 {
        background: linear-gradient(135deg, var(--tsflt-mobile-primary), var(--tsflt-mobile-primary-dark)) !important;
        color: white !important;
        box-shadow: 0 4px 12px rgba(91, 33, 182, 0.3);
    }

    .tsflt-mobile-apply-btn-flt7k3:hover {
        box-shadow: 0 6px 16px rgba(91, 33, 182, 0.4);
        transform: translateY(-1px);
    }

    .tsflt-mobile-apply-btn-flt7k3:active {
        transform: translateY(0) scale(0.98);
    }

    /* ===========================
       Body Modifier
       =========================== */
    body.tsflt-mobile-filter-open-flt7k3 {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* ===========================
   Smaller Mobile (480px and below)
   =========================== */
@media (max-width: 480px) {
    .tsflt-filter-fab-flt7k3 {
        bottom: 20px;
        right: 16px;
        min-width: 52px;
        height: 52px;
        padding: 0 16px;
    }

    .tsflt-filter-fab-flt7k3 svg {
        width: 20px;
        height: 20px;
    }

    .tsflt-fab-text-flt7k3 {
        font-size: 13px;
    }

    .tsflt-mobile-filter-panel-flt7k3 {
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
    }

    .tsflt-mobile-filter-header-flt7k3 {
        padding: 20px 16px 14px;
    }

    .tsflt-mobile-filter-header-flt7k3 h3 {
        font-size: 16px;
    }

    .tsflt-mobile-filter-body-flt7k3 {
        padding: 16px;
    }

    .tsflt-mobile-filter-group-flt7k3 {
        margin-bottom: 20px;
    }

    .tsflt-mobile-filter-group-flt7k3 > label {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .tsflt-mobile-filter-select-flt7k3,
    .tsflt-mobile-filter-input-flt7k3 {
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 10px;
    }

    .tsflt-mobile-filter-select-flt7k3 {
        padding-right: 40px;
        background-position: right 12px center;
        background-size: 16px;
    }

    .tsflt-mobile-date-range-flt7k3,
    .tsflt-mobile-price-range-flt7k3 {
        gap: 8px;
    }

    .tsflt-mobile-filter-footer-flt7k3 {
        padding: 14px 16px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        gap: 10px;
    }

    .tsflt-mobile-filter-footer-flt7k3 .tsl-btn {
        padding: 14px 20px;
        font-size: 14px;
        border-radius: 10px;
    }
}

/* ===========================
   Very Small Mobile (360px and below)
   =========================== */
@media (max-width: 360px) {
    .tsflt-fab-text-flt7k3 {
        display: none;
    }

    .tsflt-filter-fab-flt7k3 {
        width: 52px;
        padding: 0;
        border-radius: 50%;
    }

    .tsflt-mobile-date-range-flt7k3,
    .tsflt-mobile-price-range-flt7k3 {
        flex-direction: column;
        gap: 10px;
    }

    .tsflt-mobile-date-separator-flt7k3,
    .tsflt-mobile-price-separator-flt7k3 {
        display: none;
    }
}

/* ===========================
   Animations
   =========================== */
@keyframes tsflt-fab-pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(91, 33, 182, 0.4),
                    0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 24px rgba(91, 33, 182, 0.6),
                    0 2px 12px rgba(0, 0, 0, 0.15);
    }
}

/* Optional: Add pulse animation to FAB */
.tsflt-filter-fab-flt7k3.has-filters {
    animation: tsflt-fab-pulse 2s ease-in-out infinite;
}

/* ===========================
   High Contrast Mode Support
   =========================== */
@media (prefers-contrast: high) {
    .tsflt-mobile-filter-select-flt7k3,
    .tsflt-mobile-filter-input-flt7k3 {
        border-width: 3px;
    }

    .tsflt-filter-fab-flt7k3 {
        border: 3px solid white;
    }
}

/* ===========================
   Reduced Motion Support
   =========================== */
@media (prefers-reduced-motion: reduce) {
    .tsflt-filter-fab-flt7k3,
    .tsflt-mobile-filter-panel-flt7k3,
    .tsflt-mobile-filter-overlay-flt7k3,
    .tsflt-mobile-filter-select-flt7k3,
    .tsflt-mobile-filter-input-flt7k3,
    .tsflt-mobile-filter-close-flt7k3,
    .tsflt-mobile-filter-footer-flt7k3 .tsl-btn {
        transition: none;
    }

    .tsflt-filter-fab-flt7k3.has-filters {
        animation: none;
    }
}
