/**
 * Phone Formatter Styles
 * 
 * Custom styles to make phone formatter work with Bootstrap form-floating labels
 */

/* Phone input group container */
.phone-input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.phone-input-group .country-code-select {
    max-width: 120px;
    flex-shrink: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.phone-input-group .phone-number-input {
    flex-grow: 1;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 0;
	padding-left: 8px !important;
}

/* Fix for Bootstrap form-floating with phone input group */
.form-floating .phone-input-group {
    position: relative;
}

/* Ensure floating label works with phone input group */
.form-floating > .phone-input-group ~ label {
    position: absolute;
    top: 0;
    left: 120px; /* Start after country select */
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: #6c757d;
    opacity: 1;
    z-index: 2;
	line-height: 1.75rem;
}

/* Float the label when phone input group has focus */
.form-floating > .phone-input-group:focus-within ~ label {
    color: rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.65);
    transform: scale(0.65) translateY(-0.5rem) translateX(0.15rem);
}

/* Float label when phone input has value (JS adds this class) */
.form-floating > .phone-input-group.has-value ~ label {
    color: rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.65);
    transform: scale(0.65) translateY(-0.5rem) translateX(0.15rem);
}

/* Validation states */
.phone-number-input.is-valid {
    border-color: #198754;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.phone-number-input.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Ensure country select and phone input have same height */
.phone-input-group .country-code-select,
.phone-input-group .phone-number-input {
    height: calc(3.5rem + 2px);
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

/* Country select custom styles */
.phone-input-group .country-code-select {
	font-size: 1.25rem;
	line-height: 1.75rem;
	padding: 1rem;
    background-position: right 0.5rem center;
}

/* Mobile responsiveness */
@media (max-width: 576px) {
    .phone-input-group .country-code-select {
        max-width: 100px;
    }
    
    .form-floating > .phone-input-group ~ label {
        left: 100px;
    }
}

/* Focus states */
.phone-input-group .country-code-select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    z-index: 3;
}

.phone-input-group .phone-number-input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    z-index: 3;
}

/* Ensure proper border connection between select and input */
.phone-input-group .country-code-select:focus + .phone-number-input {
    border-left: 1px solid #86b7fe;
}

