/**
 * Potterhead MediaWiki — Hogwarts Dark & Magical Theme
 * Designed for wiki.potterhead.ir & wiki.potterheads.org
 */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --ph-gold: #f5cf62;
  --ph-gold-bright: #ffe699;
  --ph-gold-hover: #ffffff;
  --ph-gold-glow: rgba(245, 207, 98, 0.35);
  --ph-bg-dark: #080c14;
  --ph-surface: #0f1624;
  --ph-surface-elevated: #162033;
  --ph-surface-border: #26354f;
  --ph-text-primary: #ffffff;
  --ph-text-body: #e4ebf5;
  --ph-text-muted: #9aaec7;
}

/* Persian RTL Typography & Extreme Readability */
html[lang="fa"],
body.rtl,
.mw-content-rtl {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  direction: rtl;
  font-size: 16px;
  line-height: 1.95 !important;
  color: var(--ph-text-body) !important;
}

html[lang="en"],
body.ltr {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 16px;
  line-height: 1.8 !important;
  color: var(--ph-text-body) !important;
}

/* Global Headings */
h1, h2, h3, h4, h5, h6,
.mw-headline,
#firstHeading {
  color: var(--ph-gold-bright) !important;
  font-weight: 700 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 12px rgba(245, 207, 98, 0.25) !important;
  border-bottom-color: var(--ph-surface-border) !important;
}

html[lang="en"] #firstHeading,
html[lang="en"] .mw-headline {
  font-family: 'Cinzel', serif !important;
  letter-spacing: 0.8px;
}

#firstHeading {
  font-size: 2.2rem !important;
  padding-bottom: 0.75rem !important;
  margin-bottom: 1.5rem !important;
  border-bottom: 2px solid var(--ph-surface-border) !important;
}

h2 {
  font-size: 1.6rem !important;
  margin-top: 2.2rem !important;
  padding-bottom: 0.4rem !important;
  border-bottom: 1px solid var(--ph-surface-border) !important;
}

/* General Dark Palette */
body,
.vector-header-container,
.mw-page-container,
.vector-sticky-header-context-bar {
  background-color: var(--ph-bg-dark) !important;
  color: var(--ph-text-body) !important;
}

/* ==============================================================================
 * TOP HEADER & NAVIGATION POLISH
 * ============================================================================== */

/* Vector Header Container */
.mw-header,
.vector-header-container {
  background: linear-gradient(180deg, #0f1624 0%, #0a0f1a 100%) !important;
  border-bottom: 2px solid #2a3b57 !important;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6) !important;
  padding: 0.6rem 1.4rem !important;
}

/* Vector Legacy Top Navigation Bar */
#mw-head,
#mw-page-base {
  background: linear-gradient(180deg, #0f1624 0%, #080c14 100%) !important;
  color: var(--ph-text-primary) !important;
}

/* Legacy Vector Sidebar Logo */
.mw-wiki-logo {
  background-image: url('/themes/images/potterhead-wiki-crest.svg') !important;
  background-size: 135px 135px !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  width: 155px !important;
  height: 155px !important;
  margin: 10px auto 18px auto !important;
  display: block !important;
  filter: drop-shadow(0 0 14px rgba(245, 207, 98, 0.45));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.mw-wiki-logo:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 0 20px rgba(245, 207, 98, 0.7));
}

/* Top Right Navigation Tabs (صفحه، بحث، خواندن، ویرایش) */
.vector-menu-tabs,
.vector-menu-tabs-legacy {
  background: transparent !important;
}

.vector-menu-tabs ul li {
  background: #141c2c !important;
  border: 1px solid var(--ph-surface-border) !important;
  border-bottom: none !important;
  border-radius: 6px 6px 0 0 !important;
  margin-right: 4px !important;
  transition: all 0.2s ease !important;
}

.vector-menu-tabs ul li.selected {
  background: #1c273c !important;
  border-top: 2px solid var(--ph-gold) !important;
}

.vector-menu-tabs ul li a {
  color: #c9d8eb !important;
  font-weight: 600 !important;
  padding: 8px 14px !important;
  text-shadow: none !important;
}

.vector-menu-tabs ul li.selected a {
  color: var(--ph-gold-bright) !important;
}

.vector-menu-tabs ul li:hover a {
  color: #ffffff !important;
}

/* Personal User Bar (ورود، ایجاد حساب کاربری) */
#p-personal ul li a {
  color: var(--ph-gold) !important;
  font-weight: 600 !important;
  transition: color 0.2s ease;
}

#p-personal ul li a:hover {
  color: #ffffff !important;
  text-shadow: 0 0 8px var(--ph-gold);
}

/* Search Box */
#simpleSearch,
.cdx-text-input__input {
  background-color: #141c2c !important;
  color: #ffffff !important;
  border: 1px solid var(--ph-surface-border) !important;
  border-radius: 20px !important;
  padding: 6px 14px !important;
}

#simpleSearch:focus-within,
.cdx-text-input__input:focus {
  border-color: var(--ph-gold) !important;
  box-shadow: 0 0 10px var(--ph-gold-glow) !important;
}

#searchInput {
  color: #ffffff !important;
}

#searchButton {
  filter: invert(0.8) sepia(1) saturate(5) hue-rotate(5deg);
}

/* ==============================================================================
 * SIDEBAR & PORTLETS
 * ============================================================================== */
.vector-legacy-sidebar,
#mw-panel {
  padding-top: 10px !important;
}

.portal,
.vector-menu-portal {
  background: var(--ph-surface) !important;
  border: 1px solid var(--ph-surface-border) !important;
  border-radius: 8px !important;
  margin-bottom: 14px !important;
  padding: 8px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}

.portal h3,
.vector-menu-heading {
  color: var(--ph-gold) !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  border-bottom: 1px solid var(--ph-surface-border) !important;
  padding-bottom: 5px !important;
  margin-bottom: 8px !important;
  letter-spacing: 0.5px;
}

.portal .body li a,
.vector-menu-content-list li a {
  color: #c9d8eb !important;
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 4px 6px;
  display: block;
}

.portal .body li a:hover,
.vector-menu-content-list li a:hover {
  background-color: rgba(245, 207, 98, 0.12) !important;
  color: var(--ph-gold-bright) !important;
  padding-right: 10px;
}

/* ==============================================================================
 * ARTICLE BODY & HIGH READABILITY
 * ============================================================================== */
#mw-content-text,
.mw-body {
  background-color: var(--ph-surface) !important;
  border: 1px solid var(--ph-surface-border) !important;
  color: var(--ph-text-body) !important;
  border-radius: 12px;
  padding: 2.2rem !important;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6) !important;
  font-size: 1.06rem !important;
}

.mw-parser-output p {
  color: #e2ebf5 !important;
  margin-bottom: 1.35rem !important;
  line-height: 2 !important;
}

/* Golden Links with Crystal Clear Contrast */
a,
a:visited,
.mw-parser-output a {
  color: var(--ph-gold) !important;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover,
.mw-parser-output a:hover {
  color: var(--ph-gold-bright) !important;
  text-decoration: underline;
  text-shadow: 0 0 8px var(--ph-gold-glow);
}

/* External Link Icons */
.mw-parser-output a.external {
  color: #79c0ff !important;
}

/* ==============================================================================
 * MAGIC COMPONENTS (Quotes, Infoboxes, Tables)
 * ============================================================================== */

/* Magic Blockquotes */
blockquote,
.mw-parser-output blockquote,
.potter-quote {
  background: linear-gradient(135deg, rgba(245, 207, 98, 0.08), rgba(20, 28, 44, 0.6)) !important;
  border-right: 4px solid var(--ph-gold) !important;
  border-left: none !important;
  margin: 1.6rem 0 !important;
  padding: 1.2rem 1.6rem !important;
  border-radius: 8px;
  font-size: 1.12rem;
  line-height: 1.9 !important;
  color: #fff4cc !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

html[lang="en"] blockquote,
html[lang="en"] .potter-quote {
  border-left: 4px solid var(--ph-gold) !important;
  border-right: none !important;
}

/* Character & Lore Infobox Styling */
.infobox,
table.infobox {
  background: #141c2c !important;
  border: 1px solid #2e4162 !important;
  border-top: 4px solid var(--ph-gold) !important;
  border-radius: 10px !important;
  padding: 0.9rem !important;
  color: #ffffff !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

.infobox th {
  background: rgba(245, 207, 98, 0.15) !important;
  color: var(--ph-gold-bright) !important;
  padding: 8px 12px;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid #2e4162;
}

.infobox td {
  padding: 8px 12px;
  color: #e4ebf5 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* Tables */
.wikitable {
  background-color: #121927 !important;
  color: #ffffff !important;
  border: 1px solid #26354f !important;
  border-radius: 8px;
  border-collapse: separate !important;
  border-spacing: 0;
  overflow: hidden;
  margin: 1.4rem 0 !important;
}

.wikitable th {
  background: linear-gradient(180deg, #1f2b42 0%, #162235 100%) !important;
  color: var(--ph-gold-bright) !important;
  font-weight: 700;
  border: 1px solid #26354f !important;
  padding: 10px 14px;
}

.wikitable td {
  border: 1px solid #26354f !important;
  padding: 10px 14px;
  color: #e2ebf5 !important;
}

.wikitable tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

/* ==============================================================================
 * TABLE OF CONTENTS (TOC) & NAVIGATION POLISH
 * ============================================================================== */
.toc,
#toc,
.mw-table-of-contents-container {
  background: linear-gradient(135deg, #101726 0%, #172238 100%) !important;
  border: 1px solid #2d3f5e !important;
  border-top: 3px solid var(--ph-gold) !important;
  border-radius: 10px !important;
  padding: 1.2rem 1.4rem !important;
  margin: 1.5rem 0 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

.toctitle h2,
#toctitle h2 {
  font-size: 1.15rem !important;
  color: var(--ph-gold-bright) !important;
  border-bottom: 1px solid #2a3c5a !important;
  padding-bottom: 0.5rem !important;
  margin-bottom: 0.8rem !important;
}

.toc ul,
#toc ul {
  list-style: none !important;
  padding-right: 0 !important;
  margin: 0 !important;
}

.toc li a,
#toc li a {
  color: #d0def0 !important;
  font-size: 0.96rem !important;
  padding: 4px 8px !important;
  display: inline-block;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toc li a:hover,
#toc li a:hover {
  color: var(--ph-gold-bright) !important;
  background-color: rgba(245, 207, 98, 0.12);
  text-decoration: none !important;
  transform: translateX(-4px);
}

html[lang="en"] .toc li a:hover,
html[lang="en"] #toc li a:hover {
  transform: translateX(4px);
}

.tocnumber {
  color: var(--ph-gold) !important;
  font-weight: 700;
  margin-left: 6px;
}

html[lang="en"] .tocnumber {
  margin-left: 0;
  margin-right: 6px;
}

/* ==============================================================================
 * HOGWARTS HOUSES THEMED ACCENTS & BADGES
 * ============================================================================== */
.house-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.house-gryffindor {
  background: linear-gradient(135deg, #740001, #ae0001) !important;
  color: #ffd700 !important;
  border: 1px solid #eeba30 !important;
}

.house-slytherin {
  background: linear-gradient(135deg, #1a472a, #2a623d) !important;
  color: #e0e0e0 !important;
  border: 1px solid #aaaaaa !important;
}

.house-ravenclaw {
  background: linear-gradient(135deg, #0e1a40, #222f5b) !important;
  color: #946b2d !important;
  border: 1px solid #be8a3a !important;
}

.house-hufflepuff {
  background: linear-gradient(135deg, #ecb939, #f0c75e) !important;
  color: #111111 !important;
  border: 1px solid #372e29 !important;
}

/* Categories Bar Polish */
#catlinks,
.catlinks {
  background: #0f1624 !important;
  border: 1px solid #26354f !important;
  border-radius: 8px !important;
  padding: 10px 16px !important;
  margin-top: 2rem !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}

.catlinks li {
  border-right: 1px solid #26354f !important;
  padding: 0 10px !important;
}

.catlinks li:first-child {
  border-right: none !important;
}

/* Cross-Domain Multi-Language Header Banner */
.potterhead-mw-lang-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.2rem 0 1.8rem 0;
  padding: 1.1rem 1.6rem;
  background: linear-gradient(135deg, #162033, #1c2a42);
  border: 1px solid var(--ph-gold);
  border-radius: 12px;
  box-shadow: 0 4px 25px rgba(245, 207, 98, 0.2);
  position: relative;
  overflow: hidden;
}

.potterhead-mw-lang-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ph-gold-bright), transparent);
}

.potterhead-mw-lang-banner .banner-text {
  font-size: 1rem;
  color: #ffffff !important;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.potterhead-mw-lang-banner .banner-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.4rem;
  background: linear-gradient(135deg, rgba(245, 207, 98, 0.25), rgba(245, 207, 98, 0.1));
  color: var(--ph-gold-bright) !important;
  border: 1px solid var(--ph-gold);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.94rem;
  transition: all 0.25s ease;
}

.potterhead-mw-lang-banner .banner-link:hover {
  background: var(--ph-gold);
  color: #080c14 !important;
  text-decoration: none !important;
  box-shadow: 0 0 18px var(--ph-gold);
  transform: translateY(-2px);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: var(--ph-bg-dark);
}
::-webkit-scrollbar-thumb {
  background: #24344d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ph-gold);
}
