/* ============================================================
   NENO APP - Country code combobox
   ============================================================ */

/* Outer wrapper - sized to its trigger button, anchors the dropdown. */
.cc-select {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: 0;
}

/* The hidden input must not consume layout space */
.cc-select > input.cc-hidden {
    display: none !important;
}

/* Trigger button - styled like a Bootstrap addon. */
.cc-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #ced4da;
    color: #212529;
    font-weight: 600;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.375rem 0.55rem 0.375rem 0.65rem;
    min-height: calc(1.5em + 0.75rem + 2px); /* matches Bootstrap .form-control */
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    border-radius: 0.375rem;
}

.cc-trigger:hover {
    background: #f8f9fa;
}

.cc-trigger:focus,
.cc-trigger:focus-visible {
    outline: 0;
    border-color: var(--neno-primary, #479A1A);
    box-shadow: 0 0 0 0.2rem rgba(71, 154, 26, 0.18);
    z-index: 3;
}

/* Flag - flag-icons SVG */
.cc-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cc-fi {
    width: 1.4em;
    height: 1.05em;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    background-size: cover;
    background-position: 50% 50%;
}

.cc-flag-globe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4em;
    height: 1.05em;
    color: #6c757d;
}

.cc-code {
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.cc-caret {
    font-size: 0.7rem;
    color: #6c757d;
    margin-left: 2px;
    transition: transform 0.15s ease;
}

.cc-select.is-open .cc-caret {
    transform: rotate(180deg);
    color: var(--neno-primary, #479A1A);
}

/* ------------------------------------------------------------
   Inside a Bootstrap .input-group
   ------------------------------------------------------------ */

.input-group {
    flex-wrap: nowrap; /* Don't allow phone input to drop to next line */
}

.input-group > .cc-select {
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
    z-index: 2;
}

.input-group > .cc-select > .cc-trigger {
    width: 100%;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
    min-height: 100%;
}

/* The next sibling (phone input) gets its left side flattened and overlaps the
   trigger's right edge by 1px for the seamless joined look. */
.input-group > .cc-select + .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
    min-width: 0;
}

.input-group > .cc-select.is-open {
    z-index: 1051;
}

.input-group > .cc-select.is-open + .form-control {
    z-index: 1;
}

/* ------------------------------------------------------------
   Dropdown panel
   ------------------------------------------------------------ */
.cc-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    z-index: 1060;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.cc-select.is-open .cc-dropdown {
    display: flex;
    animation: cc-fade-in 0.12s ease-out;
}

@keyframes cc-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Search field inside dropdown */
.cc-search-wrap {
    position: relative;
    padding: 10px 12px 8px;
    border-bottom: 1px solid #f1f3f5;
}

.cc-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.9rem;
}

.cc-search {
    width: 100%;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 8px 10px 8px 32px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8fafc;
    transition: border-color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
}

.cc-search:focus {
    outline: 0;
    background: #ffffff;
    border-color: var(--neno-primary, #479A1A);
    box-shadow: 0 0 0 3px rgba(71, 154, 26, 0.12);
}

/* Country list */
.cc-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 0.95rem;
    color: #1f2937;
}

.cc-item.is-active {
    background: rgba(71, 154, 26, 0.08);
}

.cc-item.is-selected {
    color: var(--neno-primary, #479A1A);
    font-weight: 600;
}

.cc-item.is-selected.is-active {
    background: rgba(71, 154, 26, 0.14);
}

.cc-item-flag {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}

.cc-item-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-item-code {
    flex-shrink: 0;
    color: #6c757d;
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
}

.cc-item.is-selected .cc-item-code {
    color: var(--neno-primary, #479A1A);
}

.cc-divider {
    height: 1px;
    background: #f1f3f5;
    margin: 6px 8px;
}

/* Empty state for unmatched custom codes */
.cc-empty {
    padding: 14px 16px;
    color: #6c757d;
    font-size: 0.9rem;
    background: #f8fafc;
    border-top: 1px solid #f1f3f5;
}

.cc-empty kbd {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.8rem;
    font-family: inherit;
    color: #374151;
    box-shadow: 0 1px 0 #d1d5db;
}

.cc-empty strong {
    color: var(--neno-primary, #479A1A);
}

/* Scrollbar tweaks */
.cc-list::-webkit-scrollbar {
    width: 8px;
}

.cc-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.cc-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile tweaks - keep the dropdown comfortable on small screens */
@media (max-width: 575.98px) {
    .cc-trigger {
        padding: 0.375rem 0.45rem;
        font-size: 0.95rem;
    }
    .cc-dropdown {
        width: calc(100vw - 24px);
        max-width: 360px;
    }
    .cc-list {
        max-height: 260px;
    }
    .cc-item {
        padding: 10px 14px;
    }
}
