/* ============================================================
   Job Employer – phone.css
   Phone country-selector widget styles.
   Reuses the JCandPhone widget from the Candidate plugin
   (phone-country.js / window.JCandPhone).
   ============================================================ */

/* ── Map jcand variables to the employer design tokens ────── */
:root {
    --jcand-border:      #e2e8f0;
    --jcand-primary:     #2563eb;
    --jcand-bg:          #f8fafc;
    --jcand-text:        #0f172a;
    --jcand-muted:       #64748b;
    --jcand-danger:      #dc2626;
    --jcand-radius-sm:   8px;
    --jcand-font:        inherit;
    --jcand-transition:  150ms ease;
}

.jcand-phone-widget {
    position: relative;
    width: 100%;
}

.jcand-phone-input-row {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--jcand-border);
    border-radius: var(--jcand-radius-sm);
    background: #fff;
    transition: border-color var(--jcand-transition), box-shadow var(--jcand-transition);
    position: relative;
}

.jcand-phone-input-row:focus-within {
    border-color: var(--jcand-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Selector button ── */
.jcand-phone-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px 0 12px;
    background: var(--jcand-bg, #f8fafc);
    border: none;
    border-right: 1px solid var(--jcand-border);
    border-radius: var(--jcand-radius-sm) 0 0 var(--jcand-radius-sm);
    cursor: pointer;
    font-family: var(--jcand-font);
    min-width: 90px;
    flex-shrink: 0;
    transition: background var(--jcand-transition);
    white-space: nowrap;
    outline: none;
}

.jcand-phone-selector:hover {
    background: #f1f5f9;
}

.jcand-phone-selector:focus-visible {
    outline: 2px solid var(--jcand-primary);
    outline-offset: -2px;
}

.jcand-phone-flag {
    font-size: 18px;
    line-height: 1;
    display: block;
}

.jcand-phone-dial {
    font-size: .875rem;
    font-weight: 600;
    color: var(--jcand-text);
    letter-spacing: .01em;
}

.jcand-phone-chevron {
    width: 10px;
    height: 10px;
    border-right: 1.5px solid var(--jcand-muted, #94a3b8);
    border-bottom: 1.5px solid var(--jcand-muted, #94a3b8);
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
    transition: transform .15s;
    margin-left: 2px;
}

.jcand-phone-selector[aria-expanded="true"] .jcand-phone-chevron {
    transform: rotate(-135deg) translateY(-2px);
}

/* ── Number input ── */
.jcand-phone-number-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 10px 12px !important;
    font-size: .95rem !important;
    color: var(--jcand-text) !important;
    background: transparent !important;
    font-family: var(--jcand-font) !important;
    min-width: 0;
    border-radius: 0 var(--jcand-radius-sm) var(--jcand-radius-sm) 0 !important;
}

.jcand-phone-number-input::placeholder {
    color: #94a3b8;
}

/* ── Dropdown ── */
.jcand-phone-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    background: #fff;
    border: 1px solid var(--jcand-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.07);
    z-index: 100001;
    overflow: hidden;
}

.jcand-phone-search {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--jcand-border);
    outline: none;
    padding: 10px 14px;
    font-size: .875rem;
    font-family: var(--jcand-font);
    color: var(--jcand-text);
    background: var(--jcand-bg, #f8fafc);
    border-radius: 10px 10px 0 0;
}

.jcand-phone-search::placeholder { color: #94a3b8; }

.jcand-phone-list {
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    scroll-behavior: smooth;
}

.jcand-phone-list::-webkit-scrollbar { width: 5px; }
.jcand-phone-list::-webkit-scrollbar-track { background: transparent; }
.jcand-phone-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.jcand-phone-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: .875rem;
    font-family: var(--jcand-font);
    transition: background .1s;
    outline: none;
}

.jcand-phone-list-item:hover,
.jcand-phone-list-item:focus {
    background: #f1f5f9;
}

.jcand-phone-list-item.is-active {
    background: #eff6ff;
    color: var(--jcand-primary);
}

.jcand-phone-list-flag {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.jcand-phone-list-name {
    flex: 1;
    color: var(--jcand-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jcand-phone-list-dc {
    color: var(--jcand-muted, #64748b);
    font-size: .8rem;
    flex-shrink: 0;
    font-weight: 500;
}

.jcand-phone-list-empty {
    padding: 14px;
    text-align: center;
    font-size: .875rem;
    color: var(--jcand-muted, #94a3b8);
}

/* ── Validation hint ── */
.jcand-phone-hint {
    display: block;
    font-size: .8rem;
    margin-top: 5px;
    min-height: 1.2em;
    transition: color .15s;
}

.jcand-phone-hint--ok    { color: #16a34a; }
.jcand-phone-hint--error { color: var(--jcand-danger); }
.jcand-phone-hint--info  { color: var(--jcand-muted, #64748b); }

/* ── Responsive ── */
@media (max-width: 480px) {
    .jcand-phone-selector { min-width: 80px; }
}
