/* ==========================================================================
   BASE.CSS — Reset + Globale Styles
   Universeller Reset, Body-Setup, Scrollbar, Animationen
   ========================================================================== */

/* --------------------------------------------------------------------------
   Universeller Box-Sizing Reset
   Alle Elemente nutzen border-box — Padding und Border zaehlen zur Breite
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   HTML + Body Grundeinstellungen
   -------------------------------------------------------------------------- */
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* Scroll-Lock wenn Sidebar auf Mobile offen */
body.sidebar-open {
  overflow: hidden;
  touch-action: none;
}

/* Tap-Highlight fuer Mobile */
button, a, [role="button"] {
  -webkit-tap-highlight-color: rgba(44, 182, 125, 0.1);
}

/* --------------------------------------------------------------------------
   Basis-Element-Styles
   -------------------------------------------------------------------------- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   Benutzerdefinierte Scrollbar
   Schmal und dezent — passt zum dunklen Theme
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-active) transparent;
}

/* --------------------------------------------------------------------------
   Text-Auswahl Styling
   -------------------------------------------------------------------------- */
::selection {
  background: var(--accent);
  color: var(--text-primary);
}

::-moz-selection {
  background: var(--accent);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Focus-Visible Styles
   Sichtbarer Fokusring nur bei Tastatur-Navigation
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Globale Animationen
   Wiederverwendbare Keyframe-Definitionen
   -------------------------------------------------------------------------- */

/* Einblenden */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Ausblenden */
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Von links hereingleiten */
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* Nach links hinausgleiten */
@keyframes slideOut {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* Hochskalieren (fuer Modals) */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Pulsieren (fuer Aufnahme-Indikator) */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* Drehung (fuer Ladeanimationen) */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Von rechts hereingleiten (fuer Toasts) */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Nach rechts hinausgleiten */
@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Von unten hereingleiten (fuer Mobile-FAB) */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   View-Transition — Inhalt fadet kurz ein beim View-Wechsel
   -------------------------------------------------------------------------- */
.content > * {
  animation: viewFadeIn 0.15s ease both;
}

@keyframes viewFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Reduced motion — Animationen deaktivieren wenn Nutzer das will */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
