/**
 * Світла тема — підключати після auth.css та app.css.
 * Активується класом theme-light на body (перемикач зберігає вибір у sessionStorage).
 * Акцентний колір береться з :root (auth.css), тут лише світлі фони.
 */
html.theme-light {
  color-scheme: light;
}

body.theme-light {
  --auth-bg: #f5f5f7;
  --auth-surface: #ffffff;
  --auth-border: #e5e7eb;
  --auth-text: #18181b;
  --auth-muted: #6b7280;
  --auth-error: #dc2626;
  --auth-radius: 14px;
  --auth-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.12);
}

body.theme-light {
  background: var(--auth-bg);
  color: var(--auth-text);
}

/* Сторінка логіну */
body.theme-light .auth-card {
  background: var(--auth-surface);
  border-color: var(--auth-border);
  box-shadow: var(--auth-shadow);
}

body.theme-light .auth-form input[type="password"] {
  background: #fff;
  border-color: var(--auth-border);
  color: var(--auth-text);
}

/* Заголовки контенту */
body.theme-light .app-content h1 {
  color: var(--auth-text);
}

body.theme-light .app-content .page-desc {
  color: var(--auth-muted);
}

/* Навігація та хедер */
body.theme-light .app-nav a:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.theme-light .app-nav a.active {
  background: rgba(var(--auth-accent-rgb), 0.12);
}

body.theme-light .app-nav::-webkit-scrollbar-thumb {
  background: var(--auth-border);
}

/* Картки головної */
body.theme-light .app-card .app-card-title {
  color: var(--auth-text);
}

body.theme-light .app-card .app-card-desc {
  color: var(--auth-muted);
}

body.theme-light .app-card {
  background: var(--auth-surface);
  border-color: var(--auth-border);
}

body.theme-light .app-card .card-main {
  background: rgba(0, 0, 0, 0.02);
}

/* Панелі секції */
body.theme-light .section-panel-title {
  color: var(--auth-text);
}

body.theme-light .section-row .btn-secondary,
body.theme-light .section-form .btn-secondary {
  color: rgba(24, 24, 27, 0.85);
  background: rgba(var(--auth-accent-rgb), 0.12);
  border-color: rgba(var(--auth-accent-rgb), 0.35);
}

body.theme-light .section-row .btn-secondary:hover,
body.theme-light .section-form .btn-secondary:hover {
  background: rgba(var(--auth-accent-rgb), 0.18);
  border-color: rgba(var(--auth-accent-rgb), 0.45);
  color: var(--auth-text);
}

/* Модальне вікно фільтрів */
body.theme-light .filters-modal-overlay {
  background: rgba(0, 0, 0, 0.35);
}

body.theme-light .filters-modal {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

body.theme-light .filters-modal-title {
  color: var(--auth-text);
}

body.theme-light .filter-preset-item:hover {
  background: rgba(var(--auth-accent-rgb), 0.08);
}

body.theme-light .filter-preset-item--active {
  background: rgba(var(--auth-accent-rgb), 0.12);
}

/* Записи та форми */
body.theme-light .entry-name,
body.theme-light .entry-amount {
  color: var(--auth-text);
}

body.theme-light .entry-meta {
  color: var(--auth-muted);
}

body.theme-light .entry-meta .pill {
  border-color: var(--auth-border);
  background: rgba(0, 0, 0, 0.04);
  color: var(--auth-muted);
}

body.theme-light .entry-actions .btn-edit:hover {
  color: var(--auth-accent);
  background: rgba(var(--auth-accent-rgb), 0.08);
}

body.theme-light .entry-actions .btn-delete:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

body.theme-light .card-edit-form input,
body.theme-light .card-edit-form select {
  color: var(--auth-text);
}

body.theme-light .card-edit-form input::placeholder {
  color: var(--auth-muted);
}

body.theme-light .card-edit-form .edit-actions button {
  color: var(--auth-text);
}

/* Підсумок знизу */
body.theme-light .expenses-summary-bar {
  background: rgb(255 255 255 / 22%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--auth-border);
  color: var(--auth-text);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* FAB на мобільному */
@media (max-width: 640px) {
  body.theme-light .section-row--filters #btnAddEntry {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  }
}

/* Кнопка перемикача теми */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  /*margin: 0 0.5rem 0 0;*/
  background: var(--auth-bg);
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  color: var(--auth-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover {
  color: var(--auth-text);
  border-color: var(--auth-muted);
}

.theme-toggle:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 2px rgba(var(--auth-accent-rgb), 0.2);
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Іконка сонця (світла тема — показати на темному фоні як "перемкнути на світлу") */
body:not(.theme-light) .theme-toggle-icon-light {
  display: none;
}

body:not(.theme-light) .theme-toggle-icon-dark {
  display: block;
}

body.theme-light .theme-toggle-icon-light {
  display: block;
}

body.theme-light .theme-toggle-icon-dark {
  display: none;
}

/* На сторінці логіну перемикач у куті */
.auth-page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.75rem 1rem;
  z-index: 5;
}
