/* ============================================================
   Country Selector Component - Reusable CSS
   Usage: Include this CSS on any page that uses country-selector.js
   ============================================================ */

/* Phone group container */
.cs-phone-group {
    display: flex;
    direction: ltr;
    gap: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: #f5f5f5;
    line-height: normal;
    -webkit-box-shadow: inset 0 2px 0 0 #bebebe;
    box-shadow: inset 0 2px 0 0 #bebebe;
    transition: border-color 0.2s;
    position: relative;
}
.cs-phone-group:focus-within {
    -webkit-box-shadow: inset 0 2px 0 0 #2e8795;
    box-shadow: inset 0 2px 0 0 #2e8795;
}

/* Country code trigger button */
.cs-cc-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    background: transparent;
    border: none;
    border-right: 1px solid #d0d0d0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    min-width: 100px;
    min-height: 34px;
    transition: background 0.2s;
}
.cs-cc-btn:hover { background: rgba(0,0,0,0.04); }

/* Square flag in button */
.cs-cc-btn .cs-cc-flag {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.cs-cc-btn .cs-cc-code {
    font-size: 13px;
    color: #4a5568;
    font-weight: 600;
}
.cs-cc-btn .cs-cc-arrow {
    font-size: 10px;
    color: #9ca3af;
    margin-left: 2px;
}

/* Phone input — matches other textboxes */
.cs-phone-group input.cs-phone-input {
    flex: 1;
    border: 1px solid #bebebe;
    outline: none;
    padding: 6px 12px;
    font-size: 14px;
    direction: ltr;
    text-align: left;
    min-width: 0;
    background: transparent;
    height: 34px;
    line-height: 34px;
    box-sizing: border-box;
}
.cs-phone-group input.cs-phone-input::placeholder {
    color: #b0b7c0;
}

/* Dropdown panel */
.cs-cc-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.14);
    max-height: 320px;
    overflow-y: auto;
    width: 340px;
    display: none;
    direction: ltr;
    margin-top: 2px;
}
.cs-cc-dropdown.open { display: block; }

/* Search box */
.cs-cc-search {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    z-index: 2;
}
.cs-cc-search input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.cs-cc-search input:focus { border-color: #2e8795; }

/* Country list items */
.cs-cc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: background 0.15s;
    border-bottom: 1px solid #f3f4f6;
}
.cs-cc-item:last-child { border-bottom: none; }
.cs-cc-item:hover { background: #f3f4f6; }
.cs-cc-item.selected { background: #e6f7f9; font-weight: 600; color: #2e8795; }

/* Square flag in dropdown items */
.cs-cc-item .cs-cc-flag {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.cs-cc-item .cs-cc-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cs-cc-item .cs-cc-dial {
    color: #6b7280;
    font-size: 12px;
    flex-shrink: 0;
    font-weight: 600;
}

/* Divider between priority and rest */
.cs-cc-divider {
    height: 1px;
    background: #d1d5db;
    margin: 4px 0;
}

/* Scrollbar styling */
.cs-cc-dropdown::-webkit-scrollbar { width: 6px; }
.cs-cc-dropdown::-webkit-scrollbar-track { background: transparent; }
.cs-cc-dropdown::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.cs-cc-dropdown::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
