/* ==========================================================================
   FinaleRO Wiki - Custom Design System & RO Theme Styling
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- Root Color Variables --- */
:root {
  --ro-gold-50: #fffbeb;
  --ro-gold-100: #fef3c7;
  --ro-gold-200: #fde68a;
  --ro-gold-300: #fcd34d;
  --ro-gold-400: #fbbf24;
  --ro-gold-500: #f59e0b;
  --ro-gold-600: #d97706;
  --ro-gold-700: #b45309;
  
  --ro-cyan-400: #38bdf8;
  --ro-cyan-500: #0ea5e9;
  --ro-blue-600: #2563eb;
  
  --ro-crimson: #ef4444;
  --ro-emerald: #10b981;
  --ro-purple: #a855f7;

  /* Typography */
  --md-text-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --md-code-font: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* --- Dark Theme (Default FinaleRO Atmosphere) --- */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #0f172a;
  --md-primary-fg-color--light: #1e293b;
  --md-primary-fg-color--dark: #020617;
  --md-primary-bg-color: #f8fafc;
  --md-accent-fg-color: #f59e0b;
  
  --md-default-bg-color: #0b0f19;
  --md-default-bg-color--light: #111827;
  --md-default-bg-color--lighter: #1f2937;
  --md-default-fg-color: #e2e8f0;
  --md-default-fg-color--light: #94a3b8;
  --md-default-fg-color--lighter: #64748b;

  --ro-card-bg: rgba(17, 24, 39, 0.75);
  --ro-card-border: rgba(245, 158, 11, 0.2);
  --ro-card-border-hover: rgba(245, 158, 11, 0.6);
  --ro-card-glow: rgba(245, 158, 11, 0.15);
  
  --ro-header-glow: 0 4px 20px rgba(0, 0, 0, 0.6);
  --ro-table-header-bg: #1e293b;
  --ro-table-zebra: rgba(30, 41, 59, 0.4);
}

/* --- Light Theme (Clean Crisp Contrast) --- */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: #0f172a;
  --md-primary-fg-color--light: #1e293b;
  --md-primary-fg-color--dark: #020617;
  --md-accent-fg-color: #d97706;
  
  --md-default-bg-color: #f8fafc;
  --md-default-bg-color--light: #f1f5f9;
  --md-default-bg-color--lighter: #e2e8f0;
  --md-default-fg-color: #1e293b;
  --md-default-fg-color--light: #475569;
  --md-default-fg-color--lighter: #64748b;

  --ro-card-bg: #ffffff;
  --ro-card-border: #e2e8f0;
  --ro-card-border-hover: #f59e0b;
  --ro-card-glow: rgba(245, 158, 11, 0.1);

  --ro-header-glow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --ro-table-header-bg: #f1f5f9;
  --ro-table-zebra: #f8fafc;
}

/* --- Header Bar Styling --- */
.md-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: var(--ro-header-glow);
}

.md-header__title {
  font-family: 'Outfit', 'Cinzel', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* --- Left Sidebar Navigation Panel (OSRO / GitBook Style) --- */
.md-sidebar--primary {
  border-right: 1px solid rgba(245, 158, 11, 0.15);
}

[data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__scrollwrap {
  background: rgba(11, 15, 25, 0.6);
  backdrop-filter: blur(8px);
}

[data-md-color-scheme="default"] .md-sidebar--primary .md-sidebar__scrollwrap {
  background: rgba(248, 250, 252, 0.8);
}

/* Custom Scrollbar for Left Sidebar */
.md-sidebar__scrollwrap::-webkit-scrollbar {
  width: 5px;
}
.md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.25);
  border-radius: 4px;
}
.md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, 0.5);
}

/* Section / Category Headings in Left Panel */
.md-nav--primary {
  font-size: 0.77rem;
  line-height: 1.4;
}

.md-nav__item--section > .md-nav__link {
  font-family: 'Outfit', sans-serif;
  font-weight: 700 !important;
  font-size: 0.7rem !important;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--ro-gold-400) !important;
  padding-top: 0.65rem;
  padding-bottom: 0.25rem;
  margin-top: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-md-color-scheme="default"] .md-nav__item--section > .md-nav__link {
  color: var(--ro-gold-600) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Navigation Links */
.md-nav__link {
  font-size: 0.77rem !important;
  padding: 4px 10px;
  border-radius: 5px;
  margin: 1px 0;
  line-height: 1.35;
  transition: all 0.16s ease-in-out;
  color: var(--md-default-fg-color--light);
}

.md-nav__link:hover {
  color: var(--ro-gold-400);
  background: rgba(245, 158, 11, 0.08);
  padding-left: 12px;
}

/* Active Page Highlight */
.md-nav__link--active {
  font-weight: 700;
  color: var(--ro-gold-300) !important;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18) 0%, rgba(245, 158, 11, 0.04) 100%);
  border-left: 2.5px solid var(--ro-gold-400);
  border-radius: 0 5px 5px 0;
  padding-left: 10px !important;
  box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.05);
}

[data-md-color-scheme="default"] .md-nav__link--active {
  color: #b45309 !important;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-left: 2.5px solid #d97706;
}

/* Nested Sub-item Indentation */
.md-nav__list .md-nav__list {
  padding-left: 0.4rem;
  border-left: 1px dashed rgba(255, 255, 255, 0.08);
  margin-left: 0.4rem;
}

/* --- Global Typography & Headings --- */
h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #fef08a 60%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-bottom: 1rem;
}

[data-md-color-scheme="default"] h1 {
  background: linear-gradient(135deg, #0f172a 0%, #b45309 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Hero Banner & Landing Hub --- */
.ro-hero {
  position: relative;
  border-radius: 16px;
  padding: 3rem 2rem;
  margin-bottom: 2.5rem;
  background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.15), transparent 40%),
              radial-gradient(circle at bottom left, rgba(56, 189, 248, 0.12), transparent 40%),
              linear-gradient(135deg, #0f172a 0%, #111827 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.1);
  overflow: hidden;
}

.ro-hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #38bdf8, #f59e0b, #ef4444, #38bdf8);
  background-size: 300% 100%;
  animation: roGradientMove 8s ease infinite;
}

@keyframes roGradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.ro-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--ro-gold-300);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 1rem;
}

.ro-hero-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.ro-hero-title {
  font-family: 'Cinzel', 'Outfit', serif;
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 0.8rem;
  color: #ffffff;
}

.ro-hero-subtitle {
  font-size: 1.1rem;
  color: #94a3b8;
  max-width: 680px;
  line-height: 1.6;
  margin-bottom: 1.8rem;
}

.ro-hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.ro-stat-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  text-align: center;
  backdrop-filter: blur(4px);
  transition: transform 0.2s, border-color 0.2s;
}

.ro-stat-box:hover {
  transform: translateY(-2px);
  border-color: var(--ro-gold-500);
}

.ro-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  font-weight: 600;
}

.ro-stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ro-gold-400);
  margin-top: 2px;
}

/* --- Wiki Hub Category Grid --- */
.ro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.ro-card {
  position: relative;
  background: var(--ro-card-bg);
  border: 1px solid var(--ro-card-border);
  border-radius: 12px;
  padding: 1.4rem;
  text-decoration: none !important;
  color: inherit !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.ro-card:hover {
  border-color: var(--ro-card-border-hover);
  box-shadow: 0 8px 24px var(--ro-card-glow);
  transform: translateY(-4px);
}

.ro-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--ro-gold-400);
}

.ro-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--md-default-fg-color);
}

.ro-card-desc {
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
  line-height: 1.5;
  flex-grow: 1;
}

.ro-card-link-text {
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ro-gold-400);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --- Ragnarok Online Item Description Box --- */
.ro-item-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.ro-item-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
}

.ro-item-icon {
  width: 42px;
  height: 42px;
  background: #1e293b;
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}

.ro-item-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ro-gold-300);
}

.ro-item-id {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: var(--md-code-font);
}

.ro-item-slots {
  display: inline-flex;
  gap: 2px;
  margin-left: 6px;
  font-size: 0.85rem;
  color: #38bdf8;
  font-weight: bold;
}

.ro-item-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.4);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
}

.ro-spec-item strong {
  color: #94a3b8;
  font-weight: 600;
}

.ro-item-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #e2e8f0;
}

/* --- Element Badges --- */
.ro-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.ro-elem-neutral { background: #334155; color: #f1f5f9; border: 1px solid #475569; }
.ro-elem-water   { background: #0369a1; color: #e0f2fe; border: 1px solid #38bdf8; }
.ro-elem-earth   { background: #78350f; color: #fef3c7; border: 1px solid #d97706; }
.ro-elem-fire    { background: #991b1b; color: #fee2e2; border: 1px solid #f87171; }
.ro-elem-wind    { background: #065f46; color: #d1fae5; border: 1px solid #34d399; }
.ro-elem-poison  { background: #581c87; color: #f3e8ff; border: 1px solid #c084fc; }
.ro-elem-holy    { background: #854d0e; color: #fef9c3; border: 1px solid #facc15; }
.ro-elem-shadow  { background: #1e1b4b; color: #e0e7ff; border: 1px solid #818cf8; }
.ro-elem-ghost   { background: #4c1d95; color: #ede9fe; border: 1px solid #a78bfa; }
.ro-elem-undead  { background: #451a03; color: #ffedd5; border: 1px solid #fb923c; }

/* Size & Race Badges */
.ro-size-small  { background: #0f766e; color: #ccfbf1; }
.ro-size-medium { background: #1d4ed8; color: #dbeafe; }
.ro-size-large  { background: #b91c1c; color: #fee2e2; }

/* Rarity Tiers */
.ro-rarity-mvp    { background: linear-gradient(135deg, #7c2d12, #991b1b); color: #fef08a; border: 1px solid #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
.ro-rarity-rare   { background: #431407; color: #fdba74; border: 1px solid #f97316; }
.ro-rarity-custom { background: #1e1b4b; color: #a5f3fc; border: 1px solid #38bdf8; }

/* --- Commands Interactive Box --- */
.ro-cmd-table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ro-card-border);
}

.ro-cmd-table th {
  background-color: var(--ro-table-header-bg);
  color: var(--ro-gold-300);
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
}

.ro-cmd-table td {
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ro-cmd-table tr:hover td {
  background-color: var(--ro-card-glow);
}

.ro-cmd-badge {
  font-family: var(--md-code-font);
  background: rgba(245, 158, 11, 0.15);
  color: var(--ro-gold-400);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  transition: background 0.15s;
}

.ro-cmd-badge:hover {
  background: rgba(245, 158, 11, 0.35);
}

/* --- Search Filter Box Component --- */
.ro-search-filter {
  display: flex;
  gap: 12px;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.ro-search-input {
  flex: 1;
  min-width: 240px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.ro-search-input:focus {
  border-color: var(--ro-gold-500);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* --- Responsive Layout Tweaks --- */
@media screen and (max-width: 768px) {
  .ro-hero {
    padding: 2rem 1.25rem;
  }
  .ro-hero-title {
    font-size: 1.8rem;
  }
  .ro-grid {
    grid-template-columns: 1fr;
  }
}
