/**
 * WhatsApp Travel Package Widget - Frontend Styles
 * 
 * Arabic RTL design matching site blue theme
 * 
 * @package WhatsApp_Travel_Widget
 * @version 1.0
 */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

/* ========================================
   Widget Container
   ======================================== */

.wtpw-widget-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    direction: rtl;
    background: transparent !important;
}

.wtpw-widget-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    transition: none;
}

.wtpw-widget-wrapper:hover {
    box-shadow: none;
}

/* ========================================
   Widget Header - Inside Form
   ======================================== */

.wtpw-widget-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.wtpw-widget-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px !important;
    font-weight: 800;
    color: #005FA3;
    margin: 0 0 8px 0;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.35;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    max-width: 100%;
    width: 100%;
}

.wtpw-badge-new {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B6B, #FF4757);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.wtpw-widget-subtitle {
    font-size: 15px;
    color: #64748b;
    font-weight: 500;
    line-height: 1.5;
    font-family: 'Tajawal', sans-serif;
}

/* ========================================
   Form - Horizontal Blue Layout
   ======================================== */

.wtpw-booking-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    max-width: 980px;
    margin: 0 auto;
}

/* Responsive container widths */
@media (min-width: 1400px) {
    .wtpw-booking-form { max-width: 900px; }
}
@media (max-width: 1200px) and (min-width: 1025px) {
    .wtpw-booking-form { max-width: 880px; }
}

.wtpw-form-fields-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
    margin-top: 0;
}

/* ========================================
   Form Groups
   ======================================== */

.wtpw-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.wtpw-form-group:last-child {
    flex: 0 0 auto;
}

/* ========================================
   Labels
   ======================================== */

.wtpw-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0;
    font-family: 'Tajawal', sans-serif;
}

.wtpw-label-icon {
    width: 16px;
    height: 16px;
    stroke: #005FA3;
    stroke-width: 2;
    fill: none;
    position: relative;
    top: -1px; /* Fine-tune vertical alignment */
}

/* ========================================
   Inputs - Luxury Style
   ======================================== */

.wtpw-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    color: #1e293b;
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-weight: 500;
}

.wtpw-input:focus {
    background-color: #ffffff;
    border-color: #005FA3;
    box-shadow: 0 0 0 3px rgba(0, 95, 163, 0.1);
}

.wtpw-input:hover {
    border-color: #005FA3;
}

.wtpw-input::placeholder {
    color: #94a3b8;
}

/* Date Inputs */
.wtpw-date-input {
    cursor: pointer;
    color-scheme: light;
}

.wtpw-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: brightness(0) saturate(100%) invert(24%) sepia(91%) saturate(1542%) hue-rotate(186deg) brightness(95%) contrast(101%);
    opacity: 0.8;
}

/* Number Input */
.wtpw-number-input {
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-appearance: textfield;
}

.wtpw-number-input::-webkit-outer-spin-button,
.wtpw-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Select Dropdown */
.wtpw-select-input {
    cursor: pointer;
    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='%23005FA3' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 10px;
    padding-left: 36px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.wtpw-select-input option {
    background: #ffffff;
    color: #1e293b;
    padding: 10px;
    font-family: 'Tajawal', sans-serif;
}

/* ========================================
   Submit Button - Blue Theme
   ======================================== */

.wtpw-submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #005FA3 0%, #004780 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 95, 163, 0.3);
    margin-top: 0;
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
}

.wtpw-submit-button:hover {
    background: linear-gradient(135deg, #0073CC 0%, #005FA3 100%);
    box-shadow: 0 6px 16px rgba(0, 95, 163, 0.4);
    transform: translateY(-1px);
}

.wtpw-submit-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 95, 163, 0.3);
}

.wtpw-submit-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.wtpw-button-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.wtpw-button-text {
    font-family: 'Tajawal', sans-serif;
}

/* ========================================
   Loading Indicator
   ======================================== */

.wtpw-loading {
    display: none !important;
}

.wtpw-spinner {
    display: none;
}

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

/* ========================================
   Error States
   ======================================== */

.wtpw-input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

.wtpw-input:invalid:focus:not(:placeholder-shown) {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ========================================
   Responsive Design - Horizontal Layout
   ======================================== */

/* Tablets and below - Stack vertically */
@media (max-width: 1024px) {
    .wtpw-widget-title {
        font-size: 17px;
    }

    .wtpw-widget-subtitle { font-size: 11px; }

    .wtpw-booking-form {
        padding: 18px;
    }

    .wtpw-form-fields-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .wtpw-form-group {
        flex: 1 1 auto;
    }

    .wtpw-form-group:last-child {
        flex: 1 1 auto;
    }

    .wtpw-submit-button {
        width: 100%;
    }
}

/* Mobile & Tablet View */
@media (max-width: 767px) {
    .wtpw-widget-header {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    .wtpw-widget-title {
        font-size: 17px !important;
        line-height: 1.4;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .wtpw-widget-subtitle {
        font-size: 12px;
    }

    .wtpw-booking-form {
        padding: 16px;
    }

    .wtpw-form-fields-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    /* Arrival and Return date fields side-by-side */
    .wtpw-form-fields-wrapper > .wtpw-form-group:nth-child(1),
    .wtpw-form-fields-wrapper > .wtpw-form-group:nth-child(2) {
        grid-column: span 1;
    }

    /* Other fields span full width */
    .wtpw-form-fields-wrapper > .wtpw-form-group:nth-child(3),
    .wtpw-form-fields-wrapper > .wtpw-form-group:nth-child(4) {
        grid-column: span 2;
    }

    /* Make Submit button span full width */
    .wtpw-form-group:last-child {
        grid-column: span 2;
    }

    .wtpw-label { font-size: 11px; }
    .wtpw-label-icon { width: 14px; height: 14px; top: 0; }
    .wtpw-input { font-size: 13px; padding: 11px 12px; }
    .wtpw-submit-button { width: 100%; padding: 12px; font-size: 14px; }
}

/* ========================================
   Accessibility
   ======================================== */
.wtpw-input:focus-visible,
.wtpw-submit-button:focus-visible {
    outline: 2px solid #005FA3;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .wtpw-booking-form {
        border: 2px solid #005FA3;
    }

    .wtpw-input {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .wtpw-input,
    .wtpw-submit-button {
        transition: none;
    }

    .wtpw-spinner {
        animation: none;
    }
}
