/**
 * Dracula theme — register page (intl-tel-input, plan select, phone validation).
 * Loaded from resources/views/themes/dracula/auth/register.blade.php only.
 */

/* Query container: dropdown is positioned inside narrow flag strip — width uses cqi to match full field */
.register-phone-wrap {
    container-type: inline-size;
    container-name: dracula-phone;
}

/* intl-tel-input theme tokens (library defaults are light; override on .iti so dropdown inherits) */
.register-phone-wrap .iti {
    width: 100%;
    --iti-dropdown-bg: rgb(31 41 55);
    --iti-border-gray: rgba(255, 255, 255, 0.12);
    --iti-border-color: rgba(255, 255, 255, 0.12);
    --iti-hover-color: rgba(255, 255, 255, 0.08);
    --iti-dialcode-color: rgba(255, 255, 255, 0.5);
    --iti-text-gray: rgba(255, 255, 255, 0.45);
    --iti-arrow-color: rgba(255, 255, 255, 0.65);
}

.register-phone-wrap .iti__dropdown-content {
    background-color: var(--iti-dropdown-bg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    box-sizing: border-box;
}

/* Full width of phone row: dropdown’s offset parent is the flag strip; pull left by same inset as flag (1rem) */
.register-phone-wrap .iti--inline-dropdown .iti__dropdown-content {
    left: -1rem !important;
    width: 100cqi !important;
    max-width: 100cqi !important;
    min-width: 0 !important;
    margin-left: 0 !important;
}

[dir="rtl"] .register-phone-wrap .iti--inline-dropdown .iti__dropdown-content {
    left: auto !important;
    right: -1rem !important;
}

.register-phone-wrap .iti--flexible-dropdown-width .iti__country-list {
    white-space: normal;
}

.register-phone-wrap .iti__search-input {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.06) !important;
    color: #e5e7eb !important;
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 9px 12px;
}

.register-phone-wrap .iti__search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.register-phone-wrap .iti__search-input:focus {
    outline: none;
    border-radius: 4px !important;
    border-color: color-mix(in srgb, var(--primary, #f37927) 45%, transparent) !important;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary, #f37927) 35%, transparent);
}

.register-phone-wrap .iti__search-input + .iti__country-list {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Align flag block with other inputs: icons sit at left: 1rem (left-4) */
.register-phone-wrap .iti--allow-dropdown .iti__country-container {
    left: 1rem;
    right: auto;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 9999px 0 0 9999px;
}

[dir="rtl"] .register-phone-wrap .iti--allow-dropdown .iti__country-container {
    left: auto;
    right: 1rem;
}

.register-phone-wrap .iti__flag-container {
    border-radius: 9999px 0 0 9999px;
}

.register-phone-wrap .iti__selected-flag {
    border-radius: 9999px 0 0 9999px;
    background: transparent;
}

.register-phone-wrap .iti__selected-country-primary {
    padding-left: 0.5rem;
}

.register-phone-wrap .iti--allow-dropdown input,
.register-phone-wrap .iti--allow-dropdown input[type="tel"] {
    width: 100%;
    border-radius: 9999px;
    /* Library reserves flag width at x=0; shift text start by same 1rem as .iti__country-container */
    padding-left: calc(1rem + var(--iti-selected-country-arrow-padding)) !important;
    padding-right: 3rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
}

.register-phone-wrap .iti--allow-dropdown input:focus {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #f37927) 20%, transparent);
    border-color: transparent;
}

/* Same border as other fields (avoid browser red invalid outline on tel) */
.register-phone-wrap .iti--allow-dropdown input.iti__tel-input:invalid {
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.register-phone-wrap .iti--allow-dropdown input.iti__tel-input:invalid:focus {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #f37927) 20%, transparent);
    border-color: transparent;
}

/* Live validation (JS adds .register-phone-invalid) */
.register-phone-wrap.register-phone-invalid .iti--allow-dropdown input.iti__tel-input {
    border-color: rgba(248, 113, 113, 0.55) !important;
    box-shadow: none !important;
}

.register-phone-wrap.register-phone-invalid .iti--allow-dropdown input.iti__tel-input:focus {
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.28) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
}

.register-phone-wrap .iti__country-list {
    background: rgb(31 41 55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}

.register-phone-wrap .iti__country-list::-webkit-scrollbar {
    width: 8px;
}

.register-phone-wrap .iti__country-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.register-phone-wrap .iti__country-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 4px;
}

.register-phone-wrap .iti__country-name {
    color: #e5e7eb;
}

.register-phone-wrap .iti__country.iti__highlight {
    background: rgba(255, 255, 255, 0.08);
}

.register-phone-wrap .iti__country.iti__highlight .iti__country-name {
    color: #f9fafb;
}

.register-phone-wrap .iti__divider {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Narrow viewports: fullscreen country picker stays on-theme */
#dracula-register-form .iti--fullscreen-popup .iti__dropdown-content {
    background-color: rgb(31 41 55);
    box-shadow: none;
}

#dracula-register-form .iti--fullscreen-popup .iti__search-input {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #e5e7eb !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 4px !important;
    -webkit-appearance: none;
    appearance: none;
}

#dracula-register-form .iti--fullscreen-popup .iti__search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#dracula-register-form .iti--fullscreen-popup .iti__country-list {
    background: rgb(31 41 55);
    color: #e5e7eb;
}

/* Plan select: hide native chevron (prevents double-arrow with custom icon), match input colors */
.plan-select-wrap select.plan-select-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
}

.plan-select-wrap select.plan-select-input::-ms-expand {
    display: none;
}

.plan-select-wrap select.plan-select-input:invalid {
    color: rgb(107 114 128);
}

.plan-select-wrap select.plan-select-input:valid {
    color: #fff;
}

.plan-select-wrap select.plan-select-input option {
    color: #f9fafb;
    background-color: rgb(31 41 55);
}

.plan-select-wrap select.plan-select-input option[value=""] {
    color: rgb(107 114 128);
}
