/**
 * GlukoScout Universal Select2-Grade Select Box Design System
 * Solves text-arrow overlapping, unstyled browser selects, and inconsistent dropdown UX.
 */

/* Universal Select2-like styling for single-select dropdowns */
select:not([multiple]):not([size]):not(.role-select):not(.native-bare),
select:not([multiple])[size="1"]:not(.role-select):not(.native-bare),
select.form-control:not(.role-select),
.select-filter,
.select-input,
.student-select-box {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  line-height: 1.4;
  padding: 8px 46px 8px 13px !important;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #1e293b;
  background-color: #ffffff !important;
  /* Select2 chevron icon + subtle vertical separator divider */
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
    linear-gradient(to right, #e2e8f0, #e2e8f0) !important;
  background-repeat: no-repeat, no-repeat !important;
  background-position: right 14px center, right 38px center !important;
  background-size: 16px 16px, 1px 55% !important;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Hover state */
select:not([multiple]):not([size]):not(.role-select):hover,
select:not([multiple])[size="1"]:not(.role-select):hover,
select.form-control:not(.role-select):hover,
.select-filter:hover,
.select-input:hover {
  border-color: #94a3b8;
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230369a1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
    linear-gradient(to right, #cbd5e1, #cbd5e1) !important;
}

/* Focus & Active state */
select:not([multiple]):not([size]):not(.role-select):focus,
select:not([multiple])[size="1"]:not(.role-select):focus,
select.form-control:not(.role-select):focus,
.select-filter:focus,
.select-input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.16) !important;
  outline: none !important;
}

/* Compact / Filter Select */
.select-filter,
select.select-sm,
select.form-control-sm {
  min-height: 32px;
  padding: 6px 36px 6px 10px !important;
  font-size: 12px;
  border-radius: 7px;
  background-position: right 10px center, right 28px center !important;
  background-size: 13px 13px, 1px 50% !important;
}

/* Disabled state */
select:disabled {
  background-color: #f8fafc !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
  cursor: not-allowed !important;
  opacity: 0.75;
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"),
    linear-gradient(to right, #e2e8f0, #e2e8f0) !important;
}

/* Option dropdown styling */
select option {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  background-color: #ffffff;
}

select option:checked {
  background-color: #f0f9ff;
  color: #0284c7;
  font-weight: 700;
}

/* Header & Nav Pill Selects (Family switcher, auth bar, compact controls) */
#superAdminFamilySelect,
.header-pill-select,
.nav-pill-select {
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  min-height: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
  padding: 0 28px 0 10px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0369a1 !important;
  background-color: #ffffff !important;
  border: 1px solid #7dd3fc !important;
  border-radius: 7px !important;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 14px 14px !important;
  cursor: pointer !important;
}

#superAdminFamilySelect:hover,
.header-pill-select:hover,
.nav-pill-select:hover {
  border-color: #0284c7 !important;
  background-color: #f0f9ff !important;
}

/* Dedicated integrated badge & select for role selection */
.role-badge-box {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #f0f9ff !important;
  border: 1.5px solid #bae6fd !important;
  padding: 0 10px 0 12px !important;
  border-radius: 10px !important;
  height: 38px !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
}
.role-badge-box:hover {
  border-color: #7dd3fc !important;
  background: #e0f2fe !important;
}
.role-badge-box:focus-within {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
  background: #ffffff !important;
}
.role-badge-box select.role-select,
select.role-select {
  display: inline-block !important;
  border: none !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  height: 100% !important;
  min-height: 0 !important;
  line-height: 36px !important;
  padding: 0 24px 0 4px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: #0369a1 !important;
  cursor: pointer !important;
  font-family: inherit !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 2px center !important;
  background-size: 13px 13px !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  max-width: 320px !important;
  vertical-align: middle !important;
}
.role-badge-box select.role-select:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}
.role-badge-box select.role-select option {
  color: #0f172a !important;
  background: #ffffff !important;
  font-weight: 600;
  padding: 8px 12px;
}

/* Gece modu (body.night-mode): açılır listeler koyu zeminde açık yazı. Seçiciler yukarıdakilerle aynı + body.night-mode
   (beyaz !important zemin gece modunda açık yazıyla okunmuyordu). Değişkenler gluco-theme.css'ten, yoksa yedek değer. */
body.night-mode select:not([multiple]):not([size]):not(.role-select):not(.native-bare),
body.night-mode select:not([multiple])[size="1"]:not(.role-select):not(.native-bare),
body.night-mode select.form-control:not(.role-select),
body.night-mode .select-filter,
body.night-mode .select-input,
body.night-mode .student-select-box {
  background-color: var(--g-glass-solid, #112234) !important;
  color: var(--g-ink, #e2e8f0) !important;
  border-color: rgba(148, 163, 184, .28) !important;
}
body.night-mode select option { background-color: #112234; color: #e2e8f0; }
