/**
 * Country Picker Component Styles
 * With Leading Zero Detection Support
 */

/* Container */
.country-picker {
    position: relative;
    font-family: inherit;
}

/* Field Layout */
.country-picker__field {
    display: flex;
    height: 3.5rem; /* 56px matching h-14 */
    border: 1px solid #e2e8f0; /* slate-200 */
    border-radius: 0;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: visible; /* Changed from hidden to ensure dropdown isn't clipped */
    box-sizing: border-box;
}

.country-picker__field:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Country Toggle Button */
.country-picker__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 100%;
    background: #f8fafc;
    border: none;
    border-right: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    transition: background 0.15s;
    white-space: nowrap;
    min-width: 100px;
    justify-content: space-between;
}

.country-picker__toggle:hover {
    background: #f1f5f9;
}

.country-picker__toggle:focus {
    outline: none;
    background: #e2e8f0;
}

.country-picker__toggle-flag {
    font-size: 18px;
}

.country-picker__toggle-code {
    font-family: ui-monospace, monospace;
    font-size: 13px;
}

.country-picker__toggle-chevron {
    width: 16px;
    height: 16px;
    color: #64748b;
    transition: transform 0.2s;
}

.country-picker__toggle[aria-expanded="true"] .country-picker__toggle-chevron {
    transform: rotate(180deg);
}

/* Phone Input */
.country-picker__input {
    flex: 1;
    height: 100%;
    border: none;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    background: transparent;
    outline: none;
    min-width: 0;
}

.country-picker__input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Validation States */

/* Valid - Green */
.country-picker__field--valid {
    border-color: #10b981;
}

.country-picker__field--valid:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Warning - Yellow/Orange (for leading zero detection) */
.country-picker__field--warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.country-picker__field--warning:focus-within {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.country-picker__field--warning .country-picker__input {
    background: #fffbeb;
}

/* Error - Red */
.country-picker__field--error {
    border-color: #ef4444;
    background: #fef2f2;
}

.country-picker__field--error:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.country-picker__field--error .country-picker__input {
    background: #fef2f2;
}

/* Validation Messages */
.country-picker__message {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    min-height: 16px;
}

.country-picker__message--valid {
    color: #059669;
}

.country-picker__message--warning {
    color: #d97706;
}

.country-picker__message--error {
    color: #dc2626;
}

.country-picker__message--hint {
    color: #6b7280;
}

/* Leading Zero Warning Box (Prominent) */
.country-picker__warning-box {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 0;
}

.country-picker__warning-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #f97316;
}

.country-picker__warning-content {
    flex: 1;
}

.country-picker__warning-content strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #c2410c;
    margin-bottom: 2px;
}

.country-picker__warning-content p {
    font-size: 11px;
    color: #9a3412;
    margin: 0;
    line-height: 1.4;
}

.country-picker__warning-content code {
    display: inline-block;
    padding: 2px 6px;
    background: white;
    border: 1px solid #fed7aa;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    font-weight: 600;
    color: #c2410c;
}

/* Country Dropdown */
.country-picker__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 280px;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 50;
    overflow: hidden;
}

/* Search Input in Dropdown */
.country-picker__search {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.country-picker__search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

.country-picker__search-input:focus {
    border-color: #3b82f6;
}

.country-picker__search-input::placeholder {
    color: #94a3b8;
}

/* Country List */
.country-picker__list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
}

/* Country Option */
.country-picker__option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.country-picker__option:hover {
    background: #f1f5f9;
}

.country-picker__option:focus {
    outline: none;
    background: #e2e8f0;
}

.country-picker__option--selected {
    background: #eff6ff;
}

.country-picker__option--selected:hover {
    background: #dbeafe;
}

.country-picker__option-flag {
    font-size: 20px;
    flex-shrink: 0;
}

.country-picker__option-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.country-picker__option-code {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

/* Empty State */
.country-picker__empty {
    padding: 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

/* Help Tooltip Integration */
.country-picker__help {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: #94a3b8;
    cursor: help;
    transition: color 0.15s;
}

.country-picker__help:hover {
    color: #64748b;
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    /* Base styles already handle this via inheritance from parent */
}

/* Alpine.js transitions */
[x-cloak] {
    display: none !important;
}

/* Animation for warning box */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.country-picker__warning-box {
    animation: slideDown 0.2s ease-out;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .country-picker__toggle {
        min-width: 80px;
        padding: 0 8px;
    }
    
    .country-picker__toggle-name {
        display: none;
    }
    
    .country-picker__dropdown {
        position: fixed;
        top: auto;
        left: 16px;
        right: 16px;
        max-height: 60vh;
        margin-top: 8px;
    }
}
