/* =====================
   configuracoes.css
===================== */

.cfg-body {
  background: var(--bg-primary);
  min-height: 100vh;
  padding-bottom: 32px;
}

.cfg-bg {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =====================
   HEADER
===================== */
.cfg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
}

.cfg-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.cfg-header__title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

/* =====================
   SEARCH
===================== */
.cfg-search {
  margin: 4px 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1A194D;
  border-radius: 8px;
  padding: 11px 16px;
  border: 1.5px solid transparent;
  transition: border-color 0.2s;
}

.cfg-search:focus-within {
  border-color: var(--accent-green);
}

.cfg-search i {
  color: #BABACA;
  font-size: 1rem;
  flex-shrink: 0;
}

.cfg-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font);
  width: 100%;
}

.cfg-search input::placeholder {
  color: #BABACA;
}

/* =====================
   NAV / GRUPOS
===================== */
.cfg-nav {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  gap: 4px;
}

/* Item principal */
.cfg-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-align: left;
}

.cfg-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-green);
}

.cfg-item__icon {
  font-size: 1.2rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.cfg-item__label {
  flex: 1;
}

.cfg-item__arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.cfg-item__arrow.open {
  transform: rotate(90deg);
}

/* Item danger (Sair) */
.cfg-item--danger {
  color: #ef5350;
  margin-top: 8px;
  border-color: rgba(239, 83, 80, 0.2);
}

.cfg-item--danger .cfg-item__icon {
  color: #ef5350;
}

.cfg-item--danger:hover {
  background: rgba(239, 83, 80, 0.08);
  border-color: rgba(239, 83, 80, 0.5);
}

/* =====================
   SUBGRUPO (acordeão)
===================== */
.cfg-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cfg-subgroup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.cfg-subgroup.open {
  max-height: 400px;
  opacity: 1;
}

/* Item secundário (dentro do grupo) */
.cfg-subitem {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 20px;
  background: #001a4d;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.87rem;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.cfg-subitem:hover {
  background: var(--bg-card);
}

.cfg-subitem__icon {
  font-size: 1.05rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.cfg-subitem > span {
  flex: 1;
}

.cfg-subitem__right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.cfg-subitem__value {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.cfg-subitem__arrow {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* =====================
   TAG STATUS
===================== */
.cfg-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.cfg-tag--off {
  background: rgba(239, 83, 80, 0.15);
  color: #ef5350;
  border: 1px solid rgba(239, 83, 80, 0.3);
}

.cfg-tag--on {
  background: rgba(81, 230, 132, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(81, 230, 132, 0.3);
}

/* =====================
   BUSCA — ocultar itens sem match
===================== */
.cfg-item--hidden,
.cfg-group--hidden {
  display: none;
}

/* =====================
   SELETOR DE TEMA
===================== */
.tema-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  backdrop-filter: blur(2px);
}

.tema-overlay.active { display: block; }

.tema-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 36px;
  z-index: 600;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
}

.tema-modal.active { transform: translateY(0); }

.tema-modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}

.tema-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tema-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s;
}

.tema-option.selected {
  border-color: var(--accent-green);
}

.tema-preview {
  width: 100%;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* Miniaturas dos temas */
.tema-preview--dark {
  background: linear-gradient(135deg, #01003A 50%, #003994 100%);
}

.tema-preview--dark::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  height: 6px;
  border-radius: 3px;
  background: #51E684;
}

.tema-preview--light {
  background: linear-gradient(135deg, #f0f4ff 50%, #c0d0e8 100%);
}

.tema-preview--light::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  height: 6px;
  border-radius: 3px;
  background: #1a9e50;
}

.tema-preview--daltonism {
  background: linear-gradient(135deg, #01003A 50%, #003994 100%);
}

.tema-preview--daltonism::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  height: 6px;
  border-radius: 3px;
  background: #00bfff;
}

.tema-preview--lightdalton {
  background: linear-gradient(135deg, #f0f4ff 50%, #c0d0e8 100%);
}

.tema-preview--lightdalton::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  height: 6px;
  border-radius: 3px;
  background: #00bfff;
}

.tema-check {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--accent-green);
  font-size: 1rem;
  font-weight: 700;
}

.tema-option.selected .tema-check { display: block; }