/* ===========================
   INPUT BASE
   =========================== */

/* Alan sarmalayıcı — label + input + hint */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Label */
.label {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  user-select: none;
}

.label .required {
  color: #ef4444;
  margin-left: 3px;
}

/* Input sarmalayıcı — ikon desteği için */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Asıl input elementi */
.input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  line-height: 1.4;
  color: #0f172a;

  background-color: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  outline: none;

  transition:
    border-color 0.18s ease,w
    box-shadow 0.18s ease;

  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Focus */
.input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Disabled */
.input:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 1;
}

/* Readonly */
.input[readonly] {
  background-color: #f8fafc;
  color: #64748b;
  cursor: default;
}

/* ===========================
   SIZE VARIANTS
   =========================== */

.input-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
}

.input-lg {
  padding: 13px 18px;
  font-size: 16px;
  border-radius: 8px;
}

/* ===========================
   HINT / HELP TEXT
   =========================== */

.input-hint {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

/* ===========================
   ICON SUPPORT
   =========================== */

.input-icon {
  position: absolute;
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Sol ikon */
.has-icon-left .input-icon-left {
  left: 12px;
}
.has-icon-left .input {
  padding-left: 38px;
}
.has-icon-left .input-sm {
  padding-left: 32px;
}
.has-icon-left .input-lg {
  padding-left: 46px;
}

/* Sağ ikon */
.has-icon-right .input-icon-right {
  right: 12px;
}
.has-icon-right .input {
  padding-right: 38px;
}
.has-icon-right .input-sm {
  padding-right: 32px;
}
.has-icon-right .input-lg {
  padding-right: 46px;
}

/* İkon boyutları: sm ve lg */
.input-wrap .input-sm ~ .input-icon,
.input-wrap .input-icon.sm {
  width: 13px;
  height: 13px;
}
.input-wrap .input-lg ~ .input-icon,
.input-wrap .input-icon.lg {
  width: 18px;
  height: 18px;
}

/* ===========================
   PREFIX / SUFFIX (metin)
   =========================== */

.input-addon {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  background-color: #f1f5f9;
  border: 2px solid #cbd5e1;
  white-space: nowrap;
  height: 100%;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .input {
  flex: 1;
  border-radius: 0;
}

.input-group .input-addon:first-child {
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.input-group .input-addon:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.input-group .input:first-child {
  border-radius: 6px 0 0 6px;
}

.input-group .input:last-child {
  border-radius: 0 6px 6px 0;
}

/* ===========================
   TEXTAREA
   =========================== */

textarea.input {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ===========================
   CUSTOM SELECT
   =========================== */

.cs {
  position: relative;
  width: 100%;
  user-select: none;
}

/* Trigger — görünen input gibi alan */
.cs-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  color: #0f172a;
  background-color: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  text-align: left;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.cs-trigger:focus-visible {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cs.is-open .cs-trigger {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Placeholder rengi */
.cs-trigger.is-placeholder {
  color: #94a3b8;
}

/* Sol ikon alanı */
.cs-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #64748b;
}

.cs-trigger-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Seçili metin */
.cs-trigger-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chevron */
.cs-chevron {
  margin-left: auto;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.cs.is-open .cs-chevron {
  transform: rotate(180deg);
}

/* Dropdown kutusu */
.cs-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10000;
  background-color: #ffffff;
  border: 2px solid #3b82f6;
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;

  display: none;
}

.cs.is-open .cs-dropdown {
  display: block;
}

/* Seçenek */
.cs-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: #0f172a;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.cs-option:hover {
  background-color: #f1f5f9;
}

.cs-option.is-selected {
  background-color: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.cs-option.is-selected .cs-option-icon {
  color: #2563eb;
}

/* Seçenek ikonu */
.cs-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #64748b;
}

.cs-option-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Seçenek sağ tarafı — açıklama/badge */
.cs-option-meta {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

/* Ayraç */
.cs-separator {
  height: 1px;
  background-color: #f1f5f9;
  margin: 4px 0;
}

/* Grup başlığı */
.cs-group-label {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

/* Seçenek listesi scroll (tek scrollbar) */
.cs-option-list {
  max-height: 220px;
  overflow-y: auto;
}

/* Scrollbar */
.cs-option-list::-webkit-scrollbar {
  width: 4px;
}
.cs-option-list::-webkit-scrollbar-track {
  background: transparent;
}
.cs-option-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Size variants */
.cs-sm .cs-trigger {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 4px;
}
.cs-sm .cs-option {
  padding: 6px 10px;
  font-size: 13px;
}
.cs-sm.is-open .cs-trigger {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.cs-sm .cs-dropdown {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}
.cs-sm .cs-trigger-icon,
.cs-sm .cs-chevron {
  width: 14px;
  height: 14px;
}
.cs-sm .cs-trigger-icon svg,
.cs-sm .cs-chevron svg {
  width: 14px;
  height: 14px;
}

.cs-lg .cs-trigger {
  padding: 13px 18px;
  font-size: 16px;
  border-radius: 8px;
}
.cs-lg .cs-option {
  padding: 13px 18px;
  font-size: 16px;
}
.cs-lg .cs-trigger-icon,
.cs-lg .cs-chevron,
.cs-lg .cs-option-icon {
  width: 20px;
  height: 20px;
}
.cs-lg .cs-trigger-icon svg,
.cs-lg .cs-chevron svg,
.cs-lg .cs-option-icon svg {
  width: 20px;
  height: 20px;
}

/* State: error */
.cs.is-error .cs-trigger {
  border-color: #ef4444;
}
.cs.is-error.is-open .cs-trigger,
.cs.is-error .cs-trigger:focus-visible {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.cs.is-error.is-open .cs-dropdown {
  border-color: #ef4444;
}

/* State: success */
.cs.is-success .cs-trigger {
  border-color: #22c55e;
}
.cs.is-success.is-open .cs-trigger,
.cs.is-success .cs-trigger:focus-visible {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.cs.is-success.is-open .cs-dropdown {
  border-color: #22c55e;
}

/* ===========================
   CHECKBOX & RADIO
   =========================== */

.check-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: #0f172a;
}

.check-item input[type="checkbox"],
.check-item input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.check-item input[type="radio"] {
  border-radius: 50%;
}

.check-item input[type="checkbox"]:checked,
.check-item input[type="radio"]:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

/* Checkbox tik işareti */
.check-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Radio nokta */
.check-item input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ffffff;
}

.check-item input[type="checkbox"]:focus-visible,
.check-item input[type="radio"]:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.3);
  outline-offset: 2px;
}

.check-item input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.check-item:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===========================
   TOGGLE (Switch)
   =========================== */

.toggle-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: #0f172a;
}

.toggle-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background-color: #cbd5e1;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.toggle-item input[type="checkbox"]::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ffffff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-item input[type="checkbox"]:checked {
  background-color: #3b82f6;
}

.toggle-item input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.toggle-item input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.3);
  outline-offset: 2px;
}

.toggle-item input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===========================
   TOGGLE SIZE VARIANTS
   =========================== */

/* XS */
.toggle-xs input[type="checkbox"] {
  width: 30px;
  height: 17px;
}
.toggle-xs input[type="checkbox"]::after {
  width: 11px;
  height: 11px;
  top: 3px;
  left: 3px;
}
.toggle-xs input[type="checkbox"]:checked::after {
  transform: translateX(13px);
}
.toggle-xs {
  font-size: 12px;
}

/* SM */
.toggle-sm input[type="checkbox"] {
  width: 36px;
  height: 20px;
}
.toggle-sm input[type="checkbox"]::after {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}
.toggle-sm input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}
.toggle-sm {
  font-size: 13px;
}

/* LG */
.toggle-lg input[type="checkbox"] {
  width: 56px;
  height: 31px;
}
.toggle-lg input[type="checkbox"]::after {
  width: 23px;
  height: 23px;
  top: 4px;
  left: 4px;
}
.toggle-lg input[type="checkbox"]:checked::after {
  transform: translateX(25px);
}
.toggle-lg {
  font-size: 16px;
}
