/* ==========================================================================
   Nihongo Master - Modern Japanese Learning Web App
   Aesthetic: Japanese Ink & Torii Red & Sakura
   ========================================================================== */

:root {
  --primary: #e11d48;         /* Torii Crimson Red */
  --primary-hover: #be123c;
  --primary-light: #ffe4e6;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.dark {
  --primary: #f43f5e;
  --primary-hover: #fb7185;
  --primary-light: rgba(244, 63, 94, 0.15);
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-subtle: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

.font-japanese {
  font-family: 'Noto Sans JP', 'Zen Maru Gothic', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 3D Flip Card for Flashcards */
.perspective-1000 {
  perspective: 1000px;
}
.transform-style-3d {
  transform-style: preserve-3d;
}
.backface-hidden {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.rotate-y-180 {
  transform: rotateY(180deg);
}

/* Traditional Kanji Grid Canvas Background (田) */
.kanji-grid-bg {
  background-color: var(--bg-card);
  background-image: 
    linear-gradient(to right, rgba(225, 29, 72, 0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(225, 29, 72, 0.15) 1px, transparent 1px),
    linear-gradient(to right, rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 50% 50%, 50% 50%, 25% 25%, 25% 25%;
  background-position: center center;
}

/* Level Badges */
.badge-n5 {
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.dark .badge-n5 {
  background-color: rgba(5, 150, 105, 0.2);
  color: #34d399;
  border-color: #065f46;
}

.badge-n4 {
  background-color: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.dark .badge-n4 {
  background-color: rgba(22, 163, 74, 0.2);
  color: #4ade80;
  border-color: #14532d;
}

.badge-n3 {
  background-color: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.dark .badge-n3 {
  background-color: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border-color: #1e3a8a;
}

.badge-n2 {
  background-color: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}
.dark .badge-n2 {
  background-color: rgba(124, 58, 237, 0.2);
  color: #a78bfa;
  border-color: #4c1d95;
}

.badge-n1 {
  background-color: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}
.dark .badge-n1 {
  background-color: rgba(225, 29, 72, 0.2);
  color: #fb7185;
  border-color: #881337;
}

/* Card Hover Effects */
.character-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.character-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* Subtle animation pulses */
@keyframes pulseSlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}
.animate-pulse-slow {
  animation: pulseSlow 3s infinite ease-in-out;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  animation: slideInRight 0.3s ease forwards;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* KanjiVG SVG styling inside modal */
.kanjivg-container svg {
  width: 100%;
  height: 100%;
  max-width: 280px;
  max-height: 280px;
}
.kanjivg-container text {
  font-size: 8px;
  fill: #e11d48;
  font-family: sans-serif;
  font-weight: bold;
}
.kanjivg-container path {
  stroke: #1e293b;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.dark .kanjivg-container path {
  stroke: #f1f5f9;
}
.dark .kanjivg-container text {
  fill: #f43f5e;
}
