/* ==========================================================================
   AzuStiki - Stylesheet (Custom Effects, 3D Flashcard Flip, Print & Animations)
   ========================================================================== */

/* Modern CSS Reset & Smooth Scrolling */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.dark ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.4);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.7);
}

/* Glassmorphism Classes */
.glass-panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.dark .glass-panel {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(51, 65, 85, 0.5);
}

/* 3D Flashcard Flip Mechanics */
.perspective-1000 {
  perspective: 1200px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 380px;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard-inner.is-flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
}

.flashcard-face-back {
  transform: rotateY(180deg);
}

/* Interactive Ripple & Press Feedback */
.btn-press {
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-press:active {
  transform: scale(0.97);
}

/* Accessible Focus Outlines */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

/* Progress Bar Shimmer Effect */
@keyframes progressShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.progress-animated {
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0) 100%);
  animation: progressShimmer 2.5s infinite;
}

/* Badges Pulse */
@keyframes flameFlicker {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8)); }
}

.flame-icon {
  display: inline-block;
  animation: flameFlicker 1.8s infinite ease-in-out;
}

/* Dropdown & Modal Animations */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

#header-profile-dropdown:not(.hidden) {
  animation: fadeInScale 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#auth-modal:not(.hidden) > div,
#sync-info-modal:not(.hidden) > div,
#legal-modal:not(.hidden) > div {
  animation: fadeInScale 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Print Stylesheet Optimization */
@media print {
  /* Navigation, Controls und Buttons im Druck ausblenden */
  header,
  nav,
  .no-print,
  #theme-toggle,
  #role-toggle-container,
  .quick-start-grid,
  .btn-press,
  footer {
    display: none !important;
  }

  /* Wenn das Legal-Modal aktiv ist: Drucke nur den Inhalt sauber auf weißem Grund */
  body:has(#legal-modal:not(.hidden)) > *:not(#legal-modal) {
    display: none !important;
  }
  body:has(#legal-modal:not(.hidden)) #legal-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
  }
  body:has(#legal-modal:not(.hidden)) #legal-modal > div {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  #legal-modal-body {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
  #legal-modal-tabs,
  #legal-modal-close-btn,
  #legal-modal-print-btn,
  #legal-modal-footer-close-btn {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .glass-panel {
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  /* Seitenumbrüche sauber halten */
  .page-break {
    page-break-before: always;
  }

  .avoid-break {
    page-break-inside: avoid;
  }
}
