/* ==========================================================================
   NAKATSU SHOUKAI - SEARCHABLE COUNTRY & PHONE PICKER STYLES
   ========================================================================== */

.cs-container {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}

.cs-container * {
  box-sizing: border-box;
}

/* Trigger Button */
.cs-trigger-btn {
  width: 100%;
  min-height: 48px;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 11px 14px;
  color: #0F172A;
  font-size: 15px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  text-align: left;
}

.cs-trigger-btn:hover {
  border-color: #0052CC;
  background-color: #FFFFFF;
}

.cs-container.is-open .cs-trigger-btn,
.cs-trigger-btn:focus {
  border-color: #0052CC;
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.15);
  background-color: #FFFFFF;
}

/* Button Content */
.cs-btn-content {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-flag,
.cs-item-flag {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cs-name {
  font-weight: 500;
  color: #0F172A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-dial {
  font-weight: 600;
  color: #475569;
  flex-shrink: 0;
}

.cs-arrow {
  display: flex;
  align-items: center;
  color: #64748B;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.cs-container.is-open .cs-arrow {
  transform: rotate(180deg);
  color: #0052CC;
}

/* Dropdown Menu Popover */
.cs-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 290px;
  max-width: 420px;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  z-index: 2500;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: cs-fade-slide 0.15s ease-out;
}

.cs-mode-dial .cs-dropdown {
  min-width: 320px;
}

.cs-container.is-open .cs-dropdown {
  display: flex;
}

@keyframes cs-fade-slide {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Search bar */
.cs-search-wrapper {
  position: sticky;
  top: 0;
  background-color: #FFFFFF;
  padding: 10px 12px;
  border-bottom: 1px solid #E2E8F0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-search-icon {
  color: #64748B;
  display: flex;
  align-items: center;
}

.cs-search-input {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background-color: #F8FAFC;
  color: #0F172A;
  transition: all 0.2s ease;
}

.cs-search-input:focus {
  border-color: #0052CC;
  background-color: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.1);
}

/* Country List */
.cs-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 4px 0;
  overscroll-behavior: contain;
}

.cs-list::-webkit-scrollbar {
  width: 6px;
}

.cs-list::-webkit-scrollbar-track {
  background: #F1F5F9;
}

.cs-list::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 3px;
}

.cs-list::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Country Option Item */
.cs-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-size: 14px;
  color: #1E293B;
  gap: 10px;
}

.cs-item:hover,
.cs-item.is-highlighted {
  background-color: #F1F5F9;
  color: #0052CC;
}

.cs-item.is-selected {
  background-color: #EFF6FF;
  color: #0052CC;
  font-weight: 600;
}

.cs-item-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-item-dial {
  font-weight: 600;
  color: #64748B;
  font-size: 13px;
  flex-shrink: 0;
}

.cs-item:hover .cs-item-dial,
.cs-item.is-selected .cs-item-dial {
  color: #0052CC;
}

/* Empty Notice */
.cs-empty {
  padding: 20px;
  text-align: center;
  color: #94A3B8;
  font-size: 13px;
}

/* Phone Input Group (for compound phone input) */
.cs-phone-input-group {
  display: flex;
  gap: 10px;
  width: 100%;
}

.cs-phone-input-group .cs-container.cs-mode-dial {
  flex: 0 0 120px;
  width: 120px;
}

.cs-phone-input-group input[type="tel"],
.cs-phone-input-group input[type="number"],
.cs-phone-input-group input.form-control {
  flex: 1 1 auto;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .cs-dropdown {
    max-width: 90vw;
  }
  .cs-phone-input-group .cs-container.cs-mode-dial {
    flex: 0 0 110px;
    width: 110px;
  }
}
