/* ============================================
   TAMBOWASI INTERNATIONAL FIELDS
   Elegant Country Selector & Phone Input
   ============================================ */

/* ============================================
   COUNTRY SELECTOR (NATIONALITY)
   ============================================ */

.country-selector {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 300;
    color: var(--color-dark);
    background: #FFFFFF;
    border: 1px solid rgba(44, 62, 48, 0.15);
    border-radius: 3px;
    transition: all 0.3s ease;
    cursor: pointer;
    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='%232C3E30' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.country-selector:focus {
    outline: none;
    border-color: rgba(184, 152, 106, 0.5);
    box-shadow: 0 0 0 3px rgba(184, 152, 106, 0.1);
}

.country-selector option {
    padding: 0.5rem;
    font-size: 0.95rem;
}

/* ============================================
   INTL-TEL-INPUT OVERRIDES
   Premium TamboWasi Styling
   ============================================ */

/* Main input container */
.iti {
    width: 100%;
    display: block;
}

/* Phone number input */
.iti__tel-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3.5rem !important;
    font-family: var(--font-primary) !important;
    font-size: 1rem !important;
    font-weight: 300 !important;
    color: var(--color-dark) !important;
    background: #FFFFFF !important;
    border: 1px solid rgba(44, 62, 48, 0.15) !important;
    border-radius: 3px !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box;
}

.iti__tel-input:focus {
    outline: none !important;
    border-color: rgba(184, 152, 106, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(184, 152, 106, 0.1) !important;
}

.iti__tel-input::placeholder {
    color: rgba(44, 62, 48, 0.4) !important;
    font-weight: 300 !important;
}

/* Selected flag button */
.iti__selected-flag {
    padding: 0 0 0 1rem !important;
    background: transparent !important;
    border: none !important;
    height: 100% !important;
}

.iti__selected-flag:hover,
.iti__selected-flag:focus {
    background: transparent !important;
}

/* Flag container */
.iti__flag-container {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: flex !important;
    align-items: center !important;
}

/* Arrow icon */
.iti__arrow {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(44, 62, 48, 0.6);
    margin-left: 0.375rem;
    transition: transform 0.2s ease;
}

.iti__arrow--up {
    border-top: none;
    border-bottom: 5px solid rgba(44, 62, 48, 0.6);
}

/* Country dropdown */
.iti__country-list {
    background: #FFFFFF !important;
    border: 1px solid rgba(44, 62, 48, 0.15) !important;
    border-radius: 3px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    margin-top: 0.25rem !important;
    max-height: 280px !important;
    font-family: var(--font-primary) !important;
    overflow-y: auto;
}

/* Search input in dropdown */
.iti__search-input {
    width: calc(100% - 2rem) !important;
    padding: 0.75rem 1rem !important;
    margin: 0.5rem 1rem !important;
    font-family: var(--font-primary) !important;
    font-size: 0.95rem !important;
    font-weight: 300 !important;
    border: 1px solid rgba(44, 62, 48, 0.15) !important;
    border-radius: 3px !important;
    background: #FFFFFF !important;
}

.iti__search-input:focus {
    outline: none !important;
    border-color: rgba(184, 152, 106, 0.5) !important;
    box-shadow: 0 0 0 2px rgba(184, 152, 106, 0.1) !important;
}

/* Country list items */
.iti__country {
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
    font-weight: 300 !important;
    color: var(--color-dark) !important;
    transition: background 0.2s ease !important;
}

.iti__country:hover {
    background: rgba(184, 152, 106, 0.08) !important;
}

.iti__country.iti__highlight {
    background: rgba(184, 152, 106, 0.12) !important;
}

.iti__country.iti__active {
    background: rgba(184, 152, 106, 0.15) !important;
}

/* Country name and dial code */
.iti__country-name {
    margin-left: 0.5rem !important;
    color: var(--color-dark) !important;
}

.iti__dial-code {
    color: rgba(44, 62, 48, 0.6) !important;
    font-size: 0.9rem !important;
    margin-left: 0.5rem !important;
}

/* Divider line */
.iti__divider {
    border-bottom: 1px solid rgba(44, 62, 48, 0.1) !important;
    margin: 0.5rem 0 !important;
}

/* Hide the divider between regions */
.iti__country.iti__preferred {
    border-bottom: 1px solid rgba(44, 62, 48, 0.1) !important;
}

/* ============================================
   WHATSAPP TWO-FIELD LAYOUT
   ============================================ */

.whatsapp-split-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.whatsapp-country-code {
    flex: 0 0 140px;
    min-width: 140px;
}

.whatsapp-number {
    flex: 1;
}

.whatsapp-country-code select {
    width: 100%;
    padding: 0.875rem 0.75rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--color-dark);
    background: #FFFFFF;
    border: 1px solid rgba(44, 62, 48, 0.15);
    border-radius: 3px;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%232C3E30' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
}

.whatsapp-country-code select:focus {
    outline: none;
    border-color: rgba(184, 152, 106, 0.5);
    box-shadow: 0 0 0 3px rgba(184, 152, 106, 0.1);
}

.whatsapp-number input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 300;
    color: var(--color-dark);
    background: #FFFFFF;
    border: 1px solid rgba(44, 62, 48, 0.15);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.whatsapp-number input:focus {
    outline: none;
    border-color: rgba(184, 152, 106, 0.5);
    box-shadow: 0 0 0 3px rgba(184, 152, 106, 0.1);
}

.whatsapp-number input::placeholder {
    color: rgba(44, 62, 48, 0.4);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .country-selector {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
    
    .iti__tel-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem 0.875rem 3.5rem !important;
    }
    
    .iti__country-list {
        max-height: 240px !important;
        font-size: 16px !important;
    }
    
    .whatsapp-split-container {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .whatsapp-country-code {
        flex: 0 0 130px;
        min-width: 130px;
    }
    
    .whatsapp-country-code select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 0.5rem;
        padding-right: 1.5rem;
    }
    
    .whatsapp-number input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .iti__search-input {
        font-size: 16px !important;
    }
    
    .iti__country {
        padding: 0.875rem 1rem !important;
        font-size: 16px !important;
    }
    
    /* Make flag container touch-friendly */
    .iti__selected-flag {
        min-width: 3rem !important;
    }
}

/* ============================================
   ERROR STATE
   ============================================ */

.iti__tel-input.error,
.country-selector.error {
    border-color: rgba(231, 76, 60, 0.5) !important;
}

.iti__tel-input.error:focus,
.country-selector.error:focus {
    border-color: rgba(231, 76, 60, 0.7) !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.iti__country:focus {
    outline: 2px solid rgba(184, 152, 106, 0.5) !important;
    outline-offset: -2px !important;
}

.iti__search-input:focus {
    outline: none !important;
}
