/**
 * Ramirez Adventures - International Booking Fields CSS
 * Premium Country Selector with Search, International Phone with Dial Badge, and Silent Email Validator.
 */

.ra-booking-field-group {
    margin-bottom: 16px;
    position: relative;
    font-family: inherit;
    box-sizing: border-box;
}

.ra-booking-field-group * {
    box-sizing: border-box;
}

.ra-booking-field-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ra-req {
    color: #dc2626;
    font-weight: bold;
}

/* ----------------------------------------------------
 * Country Selector Trigger & Dropdown
 * ---------------------------------------------------- */
.ra-country-picker-container {
    position: relative;
    width: 100%;
}

.ra-country-trigger {
    width: 100%;
    min-height: 44px;
    padding: 9px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    user-select: none;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    text-align: left;
}

.ra-country-trigger:hover {
    border-color: #008080;
    background: #fdfdfd;
}

.ra-country-trigger:focus,
.ra-country-trigger.is-active {
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.15);
}

.ra-country-trigger.has-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.ra-country-trigger-content {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ra-country-trigger-flag {
    font-size: 1.25em;
    line-height: 1;
    display: inline-block;
}

.ra-country-trigger-name {
    font-weight: 600;
    color: #0e3047;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ra-country-trigger-code {
    color: #008080;
    font-weight: 700;
    font-size: 13px;
    background: #f0fdfa;
    padding: 2px 7px;
    border-radius: 12px;
    border: 1px solid #ccfbf1;
}

.ra-country-trigger-placeholder {
    color: #94a3b8;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 7px;
}

.ra-country-trigger-arrow {
    font-size: 10px;
    color: #64748b;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.ra-country-trigger.is-active .ra-country-trigger-arrow {
    transform: rotate(180deg);
    color: #008080;
}

/* Country Popover Dropdown */
.ra-country-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 16px 36px -4px rgba(12, 35, 64, 0.2), 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: raFadeSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.ra-country-dropdown.is-open {
    display: flex;
}

@keyframes raFadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ra-country-search-wrap {
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.ra-country-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #94a3b8;
    pointer-events: none;
}

.ra-country-search-input {
    width: 100%;
    padding: 8px 12px 8px 32px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 13.5px !important;
    color: #1e293b !important;
    background: #ffffff !important;
    outline: none !important;
    box-shadow: none !important;
}

.ra-country-search-input:focus {
    border-color: #008080 !important;
    box-shadow: 0 0 0 2px rgba(0, 128, 128, 0.15) !important;
}

.ra-country-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
    margin: 0;
    list-style: none;
    -webkit-overflow-scrolling: touch;
}

.ra-country-list::-webkit-scrollbar {
    width: 6px;
}
.ra-country-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.ra-country-option {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    cursor: pointer;
    gap: 10px;
    transition: background 0.12s ease;
    font-size: 13.5px;
    color: #1e293b;
    border-left: 3px solid transparent;
}

.ra-country-option:hover,
.ra-country-option.is-focused {
    background: #f0fdfa;
    border-left-color: #008080;
    color: #0e3047;
}

.ra-country-option.is-selected {
    background: #e6fffa;
    border-left-color: #008080;
    font-weight: 700;
}

.ra-country-opt-flag {
    font-size: 1.3em;
    line-height: 1;
}

.ra-country-opt-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ra-country-opt-dial {
    font-weight: 700;
    color: #008080;
    font-size: 12.5px;
    font-family: inherit;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 10px;
}

.ra-country-no-results {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    font-style: italic;
}

/* ----------------------------------------------------
 * WhatsApp / Phone Input with Permanent Dial Badge
 * ---------------------------------------------------- */
.ra-phone-input-wrapper {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    overflow: hidden;
}

.ra-phone-input-wrapper:hover {
    border-color: #94a3b8;
}

.ra-phone-input-wrapper.is-focused {
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.15);
}

.ra-phone-input-wrapper.has-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.ra-phone-input-wrapper.is-valid {
    border-color: #10b981;
}

.ra-phone-input-wrapper.is-disabled {
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.ra-dial-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    background: #f1f5f9;
    border-right: 1px solid #cbd5e1;
    font-weight: 700;
    font-size: 14px;
    color: #0c2340;
    user-select: none;
    letter-spacing: 0.3px;
    white-space: nowrap;
    min-width: 58px;
    transition: background 0.2s ease;
}

.ra-dial-badge.is-empty {
    color: #94a3b8;
    font-weight: 400;
}

.ra-dial-badge.is-active {
    background: #e6fffa;
    color: #008080;
    border-right-color: #bbf7d0;
}

.ra-phone-field {
    flex: 1 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 10px 13px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    min-width: 0;
}

.ra-phone-field:disabled {
    background: transparent !important;
    cursor: not-allowed !important;
    color: #94a3b8 !important;
}

.ra-phone-valid-icon {
    display: none;
    align-items: center;
    padding-right: 12px;
    color: #10b981;
    font-size: 16px;
}

.ra-phone-input-wrapper.is-valid .ra-phone-valid-icon {
    display: flex;
}

/* ----------------------------------------------------
 * Feedback & Error Labels
 * ---------------------------------------------------- */
.ra-field-feedback {
    display: none;
    font-size: 12px;
    margin-top: 5px;
    line-height: 1.35;
    color: #dc2626;
    font-weight: 500;
}

.ra-field-feedback.is-visible {
    display: block;
}

/* ----------------------------------------------------
 * Silent Email Typo Suggestion Box
 * ---------------------------------------------------- */
.ra-email-suggestion-box {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 7px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
    font-size: 12.5px;
    line-height: 1.3;
    animation: raFadeIn 0.2s ease;
}

.ra-email-suggestion-box.is-visible {
    display: flex;
}

@keyframes raFadeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

.ra-email-suggestion-text {
    flex: 1;
}

.ra-email-suggestion-text strong {
    color: #78350f;
    text-decoration: underline;
}

.ra-email-fix-btn {
    background: linear-gradient(135deg, #F67216 0%, #d85600 100%);
    color: #ffffff !important;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(246, 114, 22, 0.25);
    transition: transform 0.1s ease, background 0.2s ease;
    white-space: nowrap;
}

.ra-email-fix-btn:hover {
    background: linear-gradient(135deg, #ff8533 0%, #F67216 100%);
    transform: translateY(-1px);
}

.ra-email-dismiss-btn {
    background: transparent;
    border: none;
    color: #b45309;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    line-height: 1;
}

/* ----------------------------------------------------
 * Responsive adjustments for mobile
 * ---------------------------------------------------- */
@media (max-width: 600px) {
    .ra-country-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 16px 16px 0 0;
        max-height: 75vh;
        border: none;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
        z-index: 1000000;
    }
    .ra-country-list {
        max-height: 50vh;
    }
    .ra-country-option {
        padding: 12px 16px;
        font-size: 15px;
    }
    .ra-country-search-input {
        font-size: 16px !important; /* Prevents iOS auto-zoom */
        padding: 10px 12px 10px 34px !important;
    }
    .ra-phone-field {
        font-size: 16px !important; /* Prevents iOS auto-zoom */
    }
}
