/**
 * Description: Styles for international phone input with country code picker
 * Filepath: wwwroot/css/components/phone-input.css
 */

/* ==========================================
   PHONE INPUT CONTAINER
   ========================================== */

.phone-input-container {
    position: relative;
    width: 100%;
}

.phone-input-wrapper {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--input-bg, #fff);
    transition: all 0.2s ease;
    overflow: hidden;
}

.phone-input-wrapper:hover {
    border-color: var(--border-hover, #c0c0c0);
}

.phone-input-wrapper:focus-within {
    border-color: var(--color-primary, #23767C);
    box-shadow: 0 0 0 3px rgba(35, 118, 124, 0.1);
}

.phone-input-wrapper.input-error {
    border-color: var(--color-danger, #dc3545);
}

.phone-input-wrapper.input-error:focus-within {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* ==========================================
   COUNTRY SELECTOR (Flag + Code)
   ========================================== */

.country-selector {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--bg-light, #f8f9fa);
    border-right: 1px solid var(--border-color, #e0e0e0);
    cursor: pointer;
    transition: background 0.2s ease;
    min-width: 100px;
    gap: 6px;
}

.country-selector:hover {
    background: var(--bg-hover, #f0f1f2);
}

.country-flag {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-code {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #333);
    white-space: nowrap;
}

.country-selector-arrow {
    font-size: 12px;
    color: var(--text-muted, #6c757d);
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.country-selector.open .country-selector-arrow {
    transform: rotate(180deg);
}

/* ==========================================
   PHONE NUMBER INPUT
   ========================================== */

.phone-number-input {
    flex: 1;
    border: none;
    padding: 20px 16px;
    font-size: 15px;
    background: transparent;
    outline: none;
    min-width: 0;
    color: var(--text-primary, #333);
}

.phone-number-input::placeholder {
    color: var(--text-placeholder, #adb5bd);
}

.phone-number-input:disabled {
    background: var(--bg-disabled, #f5f5f5);
    color: var(--text-muted, #6c757d);
    cursor: not-allowed;
}

/* Verification badge */
.phone-verified-badge {
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: var(--color-success, #28a745);
}

/* ==========================================
   COUNTRY DROPDOWN
   ========================================== */

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    margin-top: 4px;
    max-height: 320px;
    overflow: hidden;
    display: none;
    animation: dropdownFadeIn 0.15s ease-out;
}

.country-dropdown.show {
    display: block;
}

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

/* Search Box */
.country-search-wrapper {
    padding: 12px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: var(--bg-light, #f8f9fa);
}

.country-search {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 12px center;
    outline: none;
    transition: border-color 0.2s ease;
}

.country-search:focus {
    border-color: var(--color-primary, #23767C);
}

.country-search::placeholder {
    color: var(--text-placeholder, #adb5bd);
}

/* Country List */
.country-list {
    max-height: 260px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.country-list-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 12px;
}

.country-list-item:hover,
.country-list-item.highlighted {
    background: var(--bg-hover, #f0f1f2);
}

.country-list-item.selected {
    background: rgba(35, 118, 124, 0.08);
}

.country-list-item.selected .country-name {
    color: var(--color-primary, #23767C);
    font-weight: 500;
}

.country-list-flag {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.country-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-dial-code {
    font-size: 13px;
    color: var(--text-muted, #6c757d);
    font-weight: 500;
}

/* Preferred countries separator */
.country-divider {
    height: 1px;
    background: var(--border-color, #e0e0e0);
    margin: 4px 0;
}

/* No results message */
.country-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted, #6c757d);
    font-size: 14px;
}

/* ==========================================
   HIDDEN FULL PHONE INPUT
   ========================================== */

.phone-full-value {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* ==========================================
   AUTH PAGE OVERRIDES
   ========================================== */

.auth-form .phone-input-wrapper {
    border-radius: 12px;
}

.auth-form .phone-input-wrapper:focus-within {
    box-shadow: 0 0 0 4px rgba(35, 118, 124, 0.1);
}

.auth-form .phone-number-input {
    padding: 14px 16px;
}

.auth-form .country-selector {
    padding: 0 14px;
}

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

@media (max-width: 480px) {
    .country-selector {
        min-width: 85px;
        padding: 0 8px;
    }
    
    .country-code {
        font-size: 13px;
    }
    
    .phone-number-input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .country-dropdown {
        max-height: 280px;
    }
}

