/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* ===== SCREEN SYSTEM ===== */
html { font-size: 17px; }
strong, b { font-weight: 500; }
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: #f7f5fa;
  overflow: hidden;
}
.screen.active { display: flex; }
.screen > div {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
  min-height: 0;
}

/* Centered on desktop */
@media (min-width: 480px) {
  .screen          { max-width: 440px; left: 50%; transform: translateX(-50%); }
  #mainHeader      { max-width: 440px; left: 50%; transform: translateX(-50%); }
  #bottomNav       { max-width: 440px; left: 50%; transform: translateX(-50%); }
}

/* ===== MATERIAL SYMBOLS (self-hosted) ===== */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url('MaterialSymbolsOutlined.woff2') format('woff2');
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* ===== BOTTOM NAV TABS ===== */
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 18px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: #4a5470;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Jost', sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.nav-tab.active {
  color: #06152E;
  background: rgba(150, 86, 178, 0.14);
}
.nav-tab:active { transform: scale(0.92); }

/* ===== FILTER TABS ===== */
.filter-tab {
  flex: 1;
  padding: 8px 4px;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: #38425C;
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-tab.active {
  background: #06152E;
  color: #ffffff;
}

.time-tab {
  padding: 10px 16px;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: #38425C;
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.time-tab.active {
  background: #06152E;
  color: #ffffff;
}

/* ===== FORM INPUTS ===== */
.form-input-wrap {
  display: flex;
  align-items: center;
  background: #f3f0f7;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
}
.form-input-wrap:focus-within {
  background: #ffffff;
  box-shadow: 0 0 0 1.5px #06152E;
}
.form-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 16px;
  font-size: 24px;
  font-weight: 500;
  font-family: 'Jost', sans-serif;
  color: #06152E;
  outline: none;
  min-width: 0;
  width: 100%;
}
.form-unit {
  padding: 0 16px 0 4px;
  font-size: 12px;
  color: #38425C;
  font-weight: 500;
  font-family: 'Jost', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== CAMERA ===== */
.cam-preview {
  aspect-ratio: 4/3;
}
#videoEl {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
#capturedImg {
  width: 100%; height: 100%; object-fit: cover; display: none;
}

/* ===== TOAST ===== */
.toast-el {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: #06152E;
  color: #f7f5fa;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Jost', sans-serif;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.toast-el.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== ANIMATION ===== */
@keyframes heartbeat {
  0%,100% { transform: scale(1); }
  14%     { transform: scale(1.12); }
  28%     { transform: scale(1); }
  42%     { transform: scale(1.07); }
  70%     { transform: scale(1); }
}
.heartbeat-anim { animation: heartbeat 2s ease-in-out infinite; }

/* ===== SUGAR TIMING BUTTONS ===== */
.sugar-timing-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1.5px solid #d9d2e3;
  background: #f3f0f7;
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #38425C;
  cursor: pointer;
  transition: all 0.2s;
}
.sugar-timing-btn.active {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}
.sugar-timing-btn:active { transform: scale(0.95); }

/* ===== NO SCROLLBAR ===== */
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ===== LANGUAGE BUTTONS ===== */
.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #d9d2e3;
  background: #f3f0f7;
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #38425C;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  justify-content: flex-start;
}
.lang-btn:active { transform: scale(0.96); }
.lang-btn.active {
  background: #06152E;
  border-color: #06152E;
  color: #ffffff;
}

/* ===== SAFE AREA (iPhone) ===== */
.pb-safe-or-3 { padding-bottom: max(12px, env(safe-area-inset-bottom)); }

/* ===== TOOLTIPS ===== */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #06152E;
  color: #f7f5fa;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Jost', sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* Tooltip for mobile (use title instead) */
@media (max-width: 768px) {
  [data-tooltip]::after {
    content: '';
    opacity: 0 !important;
    pointer-events: none;
  }
}

/* Better focus indicators for accessibility */
button:focus-visible {
  outline: 2px solid #9656B2;
  outline-offset: 2px;
}

/* Screenreader-only: visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== NAV BAR TOUCH FIX ===== */
#bottomNav {
  z-index: 999 !important;
  pointer-events: auto !important;
  isolation: isolate;
}
#bottomNav * {
  pointer-events: auto !important;
}
#mainHeader {
  z-index: 998 !important;
}

/* ===== REMINDER TOGGLE ===== */
.toggle-bg  { background: var(--color-outline-variant, #cfc8d9); }
.toggle-dot { transition: transform 0.2s ease; }
/* Sibling combinator: input (opacity-0, z-10) → toggle-bg → toggle-dot */
.reminder-toggle:checked ~ .toggle-bg  { background: var(--color-primary, #06152E) !important; }
.reminder-toggle:checked ~ .toggle-dot { transform: translateX(1.25rem); }

/* ===== Einstellungen: Akkordeon ===== */
.settings-acc-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.settings-acc-summary::-webkit-details-marker { display: none; }
.settings-acc-summary::marker { content: ''; }
.settings-acc-summary:active { background: var(--color-surface-container-low, #f3f0f7); }
.settings-acc-chev { transition: transform 0.2s; }
.settings-acc[open] > .settings-acc-summary .settings-acc-chev { transform: rotate(180deg); }
