/* ============================================================
   Singlish.lk — Compiled CSS (extracted from Next.js globals.css)
   Brand: #C8191A / #1C2333 · Dark mode via .dark on <html>
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  --background: #ffffff;
  --foreground: #1C2333;
  --brand-red:  #C8191A;
  --brand-dark: #1C2333;
  --surface:    #ffffff;
  --surface-2:  #f9fafb;
  --border:     #e5e7eb;
}

html.dark {
  color-scheme: dark;
  --background: #000000;
  --foreground: #e2e8f0;
  --surface:    #111111;
  --surface-2:  #000000;
  --border:     #2a2a2a;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  font-family: 'Inter', 'Noto Sans Sinhala', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--foreground);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ── Animations ── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes waveform {
  0%, 100% { transform: scaleY(0.3); opacity: 0.4; }
  50%      { transform: scaleY(1);   opacity: 1; }
}
@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.animate-fade-in-up { animation: fade-in-up 0.6s ease-out forwards; }
.animate-fade-in    { animation: fade-in 0.4s ease-out forwards; }
.animate-scale-in   { animation: scale-in 0.4s ease-out forwards; }
.animate-slide-up   { animation: slide-up 0.3s ease-out forwards; }
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

.stagger-enter {
  opacity: 0;
  transform: translateY(20px);
}
.stagger-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* ── Font Faces ── */
@font-face {
  font-family: 'FMAbabldBold';
  src: url('/fonts/Legacy%20Fonts/FM%20-%20Ababld%20-Bold.TTF') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'FMAbbayaX';
  src: url('/fonts/Legacy%20Fonts/FM%20-%20Abbaya%20x.TTF') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'FMArjunnX';
  src: url('/fonts/Legacy%20Fonts/FM%20-%20Arjunn%20x.TTF') format('truetype');
  font-display: swap;
}

.sinhala-text {
  font-family: 'Noto Sans Sinhala', serif;
  line-height: 1.8;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ============================================================
   Dark mode: extra one-off overrides (the main utility map lives at the
   end of this file).
   CONTRACT: `!important` rules anywhere in this file beat same-property
   `dark:` variants on the SAME element, so do NOT add a `dark:` variant
   whose base class is overridden below or in the tail map — it will be
   dead code. Safe `dark:` targets are bases with NO override entry
   (e.g. `bg-gray-50/70`, `bg-ink`, `bg-brand/5`, `hover:` states).
   18 content views rely on these rules for dark mode — remove only with
   a full dark-mode audit.
   ============================================================ */
html.dark .bg-gray-50\/50    { background-color: #111111 !important; }
html.dark .shadow-sm         { box-shadow: 0 1px 2px 0 rgba(0,0,0,0.6) !important; }
html.dark .shadow-xl         { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.4) !important; }
html.dark .shadow-2xl        { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5) !important; }
html.dark .ring-1            { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05) !important; }

/* Card surfaces */
html.dark .dark-card-surface  { background-color: #1e1e1e !important; }
html.dark .dark-card-border   { border-color: #333333 !important; }
html.dark .dark-card-glow     { box-shadow: 0 0 30px -5px rgba(200,25,26,0.15) !important; }
html.dark .dark-card-gradient { background: linear-gradient(to bottom right, #1a1a1a, #111111) !important; }
html.dark .dark-ring          { --tw-ring-color: #333333 !important; }

html.dark .placeholder-gray-300::placeholder { color: #475569 !important; }
html.dark .placeholder-gray-500::placeholder { color: #475569 !important; }
html.dark .hover\:bg-gray-50:hover  { background-color: #1c1c1c !important; }
html.dark .hover\:bg-gray-200:hover { background-color: #2a2a2a !important; }
html.dark .hover\:text-\[\#1C2333\]:hover { color: #e2e8f0 !important; }
html.dark .hover\:text-gray-600:hover { color: #94a3b8 !important; }
html.dark .hover\:text-gray-700:hover { color: #cbd5e1 !important; }
html.dark .bg-gray-50\/40 { background-color: rgba(28, 28, 28, 0.4) !important; }
html.dark .bg-gray-50\/80 { background-color: rgba(28, 28, 28, 0.8) !important; }
html.dark .bg-white\/80   { background-color: rgba(17, 17, 17, 0.8) !important; }
html.dark .bg-white\/90   { background-color: rgba(17, 17, 17, 0.9) !important; }
html.dark .bg-white\/95   { background-color: rgba(17, 17, 17, 0.95) !important; }
html.dark .bg-white\/70   { background-color: rgba(17, 17, 17, 0.7) !important; }

/* Gradient overrides */
html.dark .from-gray-50  { --tw-gradient-from: #1c1c1c !important; }
html.dark .via-white     { --tw-gradient-via: #111111 !important; }
html.dark .to-gray-50    { --tw-gradient-to: #1c1c1c !important; }
html.dark .from-gray-100 { --tw-gradient-from: #1a1a1a !important; }
html.dark .to-gray-100   { --tw-gradient-to: #1a1a1a !important; }
html.dark .from-gray-200 { --tw-gradient-from: #2a2a2a !important; }
html.dark .to-gray-200   { --tw-gradient-to: #2a2a2a !important; }

/* Accent banners */
html.dark .bg-red-50    { background-color: rgba(127, 29, 29, 0.25) !important; }
html.dark .bg-amber-50  { background-color: rgba(120, 53, 15, 0.25) !important; }
html.dark .bg-yellow-50 { background-color: rgba(113, 63, 18, 0.25) !important; }
html.dark .bg-green-50  { background-color: rgba(20, 83, 45, 0.25) !important; }
html.dark .bg-blue-50   { background-color: rgba(30, 58, 138, 0.25) !important; }

/* Gradient accent */
html.dark .from-red-50       { --tw-gradient-from: rgba(127, 29, 29, 0.25) !important; }
html.dark .to-rose-50        { --tw-gradient-to: rgba(159, 18, 57, 0.25) !important; }
html.dark .from-amber-50     { --tw-gradient-from: rgba(120, 53, 15, 0.25) !important; }
html.dark .to-yellow-50      { --tw-gradient-to: rgba(113, 63, 18, 0.25) !important; }
html.dark .from-red-100      { --tw-gradient-from: rgba(127, 29, 29, 0.3) !important; }
html.dark .to-red-100\/50    { --tw-gradient-to: rgba(127, 29, 29, 0.15) !important; }
html.dark .from-blue-100\/50 { --tw-gradient-from: rgba(30, 58, 138, 0.2) !important; }
html.dark .to-blue-200\/30   { --tw-gradient-to: rgba(30, 58, 138, 0.1) !important; }
html.dark .from-red-100\/50  { --tw-gradient-from: rgba(127, 29, 29, 0.2) !important; }
html.dark .to-red-200\/30    { --tw-gradient-to: rgba(127, 29, 29, 0.1) !important; }
html.dark .from-blue-50      { --tw-gradient-from: rgba(30, 58, 138, 0.25) !important; }
html.dark .to-blue-100\/50   { --tw-gradient-to: rgba(30, 58, 138, 0.2) !important; }
html.dark .from-red-50\/10   { --tw-gradient-from: rgba(200, 25, 26, 0.05) !important; }
html.dark .to-red-50\/5      { --tw-gradient-to: rgba(200, 25, 26, 0.03) !important; }

/* Purple */
html.dark .bg-purple-100     { background-color: rgba(88, 28, 135, 0.3) !important; }
html.dark .text-purple-700   { color: #c4b5fd !important; }
html.dark .ring-purple-300   { --tw-ring-color: rgba(139, 92, 246, 0.4) !important; }
html.dark .from-purple-50\/50 { --tw-gradient-from: rgba(88, 28, 135, 0.15) !important; }

/* Border opacity */
html.dark .border-gray-200\/80  { border-color: rgba(42, 42, 42, 0.8) !important; }
html.dark .border-gray-200\/60  { border-color: rgba(42, 42, 42, 0.6) !important; }
html.dark .border-gray-200\/70  { border-color: rgba(42, 42, 42, 0.7) !important; }
html.dark .border-amber-200\/60 { border-color: rgba(180, 83, 9, 0.3) !important; }

/* Status text */
html.dark .text-amber-700  { color: #fbbf24 !important; }
html.dark .text-red-700    { color: #fca5a5 !important; }
html.dark .text-green-700  { color: #86efac !important; }

/* Compound gradients */
html.dark .bg-gradient-to-br.from-purple-50\/50.to-white {
  background: linear-gradient(to bottom right, rgba(88, 28, 135, 0.15), #111111) !important;
}
html.dark .bg-gradient-to-br.from-gray-50.to-gray-100 {
  background: linear-gradient(to bottom right, #1c1c1c, #1a1a1a) !important;
}
html.dark .bg-gradient-to-br.from-gray-100.to-gray-200 {
  background: linear-gradient(to bottom right, #1a1a1a, #2a2a2a) !important;
}
html.dark .bg-gradient-to-br.from-red-50.to-red-100\/50 {
  background: linear-gradient(to bottom right, rgba(127, 29, 29, 0.2), rgba(127, 29, 29, 0.1)) !important;
}
html.dark .bg-gradient-to-br.from-blue-50.to-blue-100\/50 {
  background: linear-gradient(to bottom right, rgba(30, 58, 138, 0.2), rgba(30, 58, 138, 0.1)) !important;
}
html.dark .bg-gradient-to-br.from-amber-100.to-orange-100 {
  background: linear-gradient(to bottom right, rgba(217, 119, 6, 0.2), rgba(234, 88, 12, 0.2)) !important;
}
html.dark .border-amber-200 { border-color: rgba(180, 83, 9, 0.3) !important; }

/* Ribbon / hover borders */
html.dark .doc-ribbon-group.border-r { border-right-color: #333 !important; }
html.dark .doc-ribbon-select { background: #1a1a1a; border-color: #444; color: #ccc; }
html.dark .hover\:border-blue-400:hover { border-color: rgba(96, 165, 250, 0.5) !important; }
html.dark .hover\:border-purple-400:hover { border-color: rgba(167, 139, 250, 0.5) !important; }
html.dark .hover\:border-\[#C8191A\]\/40:hover { border-color: rgba(200, 25, 26, 0.4) !important; }
html.dark .hover\:border-\[#C8191A\]\/60:hover { border-color: rgba(200, 25, 26, 0.6) !important; }

/* OverlayScrollbars theme */
.os-theme-singlish {
  --os-size: 8px;
  --os-padding-perpendicular: 2px;
  --os-padding-axis: 2px;
  --os-track-border-radius: 4px;
  --os-track-bg: rgba(0, 0, 0, 0.04);
  --os-track-bg-hover: rgba(0, 0, 0, 0.07);
  --os-track-bg-active: rgba(0, 0, 0, 0.1);
  --os-handle-border-radius: 4px;
  --os-handle-bg: rgba(200, 25, 26, 0.4);
  --os-handle-bg-hover: rgba(200, 25, 26, 0.6);
  --os-handle-bg-active: rgba(200, 25, 26, 0.8);
  --os-handle-min-size: 28px;
  --os-handle-max-size: none;
  --os-handle-interactive-area-offset: 0;
}
html.dark .os-theme-singlish {
  --os-track-bg: rgba(255, 255, 255, 0.04);
  --os-track-bg-hover: rgba(255, 255, 255, 0.07);
  --os-track-bg-active: rgba(255, 255, 255, 0.1);
  --os-handle-bg: rgba(200, 25, 26, 0.35);
  --os-handle-bg-hover: rgba(200, 25, 26, 0.55);
  --os-handle-bg-active: rgba(200, 25, 26, 0.75);
}

.main-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* No top clearance: the mobile top bar is sticky (in-flow), not fixed. */
  padding-top: 0;
}

.main-panel-inner {
  /* Full-bleed content: the sidebar owns its fixed width, main takes the rest. */
  width: 100%;
  padding: 1.5rem 1rem;
  flex: 1;
}
@media (min-width: 640px) { .main-panel-inner { padding: 1.5rem; } }

/* Alert boxes */
.alert-error {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: #dc2626;
}
.alert-success {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: #15803d;
}

/* Textarea & output (generic tool) */
textarea.singlish-input {
  width: 100%;
  min-height: 140px;
  font-size: 18px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-family: inherit;
}
.output {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  min-height: 140px;
  font-size: 20px;
}
html.dark .output { background: #111111; border-color: #2a2a2a; color: #e2e8f0; }
/* ── Dark-mode overrides for Tailwind light utilities (no dark: variants in views) ── */
html.dark .bg-white { background-color: #111111 !important; }
html.dark .bg-gray-50 { background-color: #0a0a0a !important; }
html.dark .bg-gray-100 { background-color: #1a1a1a !important; }
html.dark .bg-gray-200 { background-color: #262626 !important; }
html.dark .border-gray-100 { border-color: #222222 !important; }
html.dark .border-gray-200 { border-color: #2a2a2a !important; }
html.dark .border-gray-300 { border-color: #3a3a3a !important; }
html.dark .text-ink { color: #e2e8f0 !important; }
html.dark .text-gray-900 { color: #f1f5f9 !important; }
html.dark .text-gray-800 { color: #e2e8f0 !important; }
html.dark .text-gray-700 { color: #cbd5e1 !important; }
html.dark .text-gray-600 { color: #94a3b8 !important; }
html.dark .text-gray-500 { color: #64748b !important; }
html.dark .divide-gray-200 > * + * { border-color: #2a2a2a !important; }
html.dark input, html.dark textarea, html.dark select { background-color: #0a0a0a !important; color: #e2e8f0 !important; border-color: #2a2a2a !important; }
html.dark input::placeholder, html.dark textarea::placeholder { color: #52525b !important; }
