/* ==============================
   SYSTEM SETTINGS
================================ */

.settings-header {
  margin-bottom: 20px;
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.settings-subtitle {
  font-size: 14px;
  color: #666;
  margin-top: 4px;
}

/* ==============================
   GRID
================================ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ==============================
   CARD
================================ */

.settings-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.settings-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

/* ==============================
   ICON
================================ */

.settings-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-card-icon i {
  font-size: 20px;
  color: #ffffff;
}

/* ==============================
   CONTENT
================================ */
.settings-card-content {
  display: flex;
  flex-direction: column;
  flex: 1; /* 👈 OBLIGATORIO */
  width: 100%; /* 👈 OBLIGATORIO */
  align-items: flex-start;
  text-align: left;
}

.settings-card-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px 0;
  text-align: left;
}

.settings-card-content p {
  font-size: 13px;
  color: #666;
  margin: 0;
  line-height: 1.4;
  text-align: left;
}

/* ==============================
   EMPTY STATE
================================ */

.settings-grid p {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 14px;
  color: #888;
}

/* ==============================
   PAGE WRAPPER
================================ */
.system-settings-wrapper {
  padding: 0 16px 24px; /* 👈 margen lateral */
}

/* ==============================
   HEADER
================================ */

.settings-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.settings-back-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--color-primary, #2563eb);
}

.settings-back-btn i {
  font-size: 18px;
}

.settings-title h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.settings-subtitle {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

/* =========================
   SYSTEM SETTINGS · SWITCH (iOS STYLE)
========================= */
.system-settings-switch {
  position: relative;
  width: 40px;
  height: 22px;
}

.system-settings-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.system-settings-switch-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: 0.2s;
}

.system-settings-switch-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.system-settings-switch input:checked + .system-settings-switch-slider {
  background: var(--color-primary);
}

.system-settings-switch input:checked + .system-settings-switch-slider::before {
  transform: translateX(18px);
}

.system-settings-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.system-settings-switch-text {
  font-size: 20px;
  font-weight: 500;
}

/* =========================
   READINGS LIST (MODERN)
========================= */

.system-settings-readings-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-settings-reading-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: 0.15s ease;
}

.system-settings-reading-card:hover {
  background: #f9fafb;
}

.reading-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.reading-card-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
}

.reading-card-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.reading-card-status.active {
  background: #dcfce7;
  color: #166534;
}

.reading-card-status.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.system-settings-empty {
  padding: 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

/* =========================
   READING VALUES
========================= */

.system-settings-values-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.system-settings-values-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.system-settings-values-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-settings-range-header,
.system-settings-range-row {
  display: grid;
  grid-template-columns: 1fr 120px 1.5fr;
  align-items: center;
}

.system-settings-range-header {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  padding: 0 8px 6px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.system-settings-range-row {
  background: #ffffff;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 6px;
}

.range-status.low {
  color: #dc2626;
  font-weight: 600;
}

.range-status.ok {
  color: #16a34a;
  font-weight: 600;
}

.range-status.high {
  color: #f59e0b;
  font-weight: 600;
}

.range-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.system-settings-range-form {
  background: #f9fafb;
  padding: 15px;
  border-radius: 10px;
  margin-top: 15px;
}

.range-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* =========================
   RANGE INLINE ROW
========================= */

.range-row-inline {
  display: flex;
  gap: 20px;
}

.range-inline-item {
  flex: 1;
}

/* Mejor estilo para select color */
#rangeColor {
  border-left: 12px solid #ccc;
}

/* =========================
   COLOR PICKER CUSTOM
========================= */

.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: 0.2s;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border: 2px solid #111827;
}

/* =========================
   CUSTOM COLOR SELECT
========================= */

.color-select {
  position: relative;
  width: 100%;
}

.color-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.color-select-trigger:hover {
  border-color: #9ca3af;
}

.color-arrow {
  font-size: 12px;
  color: #6b7280;
}

.color-select-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  display: none;
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
}

.color-select-dropdown.open {
  display: block;
}

.color-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: 0.15s;
}

.color-select-option:hover {
  background: #f3f4f6;
}

.color-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.range-inactive {
  opacity: 0.4;
}

/* =========================
   READING CARD RANGES
========================= */

.reading-card-ranges {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reading-range-line {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

.range-inactive {
  opacity: 0.4;
}

.reading-card-ranges-table {
  margin-top: 10px;
  font-size: 11px;
  color: #6b7280;
}

.ranges-header {
  display: grid;
  grid-template-columns: 140px 1fr;
  font-weight: 600;
  margin-bottom: 4px;
}

.ranges-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  padding: 2px 0;
}

.ranges-col-range {
  font-weight: 500;
}

.ranges-col-desc {
  text-align: left;
}

.range-inactive {
  opacity: 0.4;
}

/* =========================
   CLIENT SEARCH SELECT
========================= */

.client-select {
  position: relative;
  width: 100%;
}

.client-select input[type='text'] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.client-select-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  z-index: 30;
}

.client-select-dropdown.open {
  display: block;
}

.client-select-option {
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}

.client-select-option:hover {
  background: #f9fafb;
}

.client-select-empty {
  padding: 10px;
  font-size: 13px;
  color: #9ca3af;
}
