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

:root {
  --bg-main: #09090B;
  --bg-secondary: #18181B;
  --bg-glass: rgba(24, 24, 27, 0.75);
  --primary-color: #3390EC; /* Telegram Blue */
  --primary-glow: rgba(51, 144, 236, 0.3);
  --text-main: #FAFAFA;
  --text-muted: #A1A1AA;
  --border-color: rgba(255, 255, 255, 0.08);
  --success: #34C759;
  --danger: #FF3B30;
  --warning: #FF9500;
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* Header */
.wiki-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.logo span b {
  color: var(--primary-color);
}

/* Search Bar */
.search-container {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 11px 16px 11px 46px;
  border-radius: 24px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 16px var(--primary-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-cabinet {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-cabinet:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
}

/* Main Container Layout */
.wiki-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
  flex: 1;
}

/* Sidebar */
.wiki-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.category-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-title {
  font-family: var(--font-title);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 8px;
  padding-left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.article-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.article-link.active {
  color: #fff;
  background: rgba(51, 144, 236, 0.12);
  border-left: 3px solid var(--primary-color);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 9px;
  font-weight: 600;
}

/* Content Area */
.wiki-content {
  min-width: 0; /* Prevents overflow in flex/grid items */
}

/* Home Welcome Screen */
.welcome-screen {
  animation: fadeIn 0.4s ease-out forwards;
}

.welcome-hero {
  margin-bottom: 40px;
  text-align: left;
}

.welcome-hero h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #FFF 0%, #A1A1AA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 700px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.category-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-color);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4), 0 0 20px rgba(51,144,236,0.05);
}

.card-icon {
  background: rgba(51, 144, 236, 0.1);
  color: var(--primary-color);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-card h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
}

.category-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.card-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 16px;
}

.card-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-link:hover {
  text-decoration: underline;
}

/* Article Screen */
.article-screen {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px;
  min-height: 500px;
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.article-meta {
  font-size: 0.8rem;
  color: var(--primary-color);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.article-title {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

/* Article Body Typography */
.article-body h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 36px 0 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 8px;
}

.article-body h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin: 28px 0 12px 0;
}

.article-body p {
  font-size: 0.98rem;
  color: #E4E4E7;
  margin-bottom: 18px;
  line-height: 1.75;
}

.article-body ul, .article-body ol {
  margin-bottom: 24px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-body li {
  font-size: 0.98rem;
  color: #E4E4E7;
  line-height: 1.65;
}

.article-body li strong {
  color: #fff;
}

.article-body code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 6px;
  border-radius: 6px;
  color: #FF9500;
  font-size: 0.88rem;
}

.article-body pre {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  overflow-x: auto;
  margin: 20px 0;
}

.article-body pre code {
  background: transparent;
  padding: 0;
  color: #E4E4E7;
  font-size: 0.9rem;
}

/* Callouts (AezaWiki Style) */
.callout {
  padding: 16px 20px;
  border-radius: 14px;
  margin: 24px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.callout-info {
  background: rgba(51, 144, 236, 0.08);
  border-left: 4px solid var(--primary-color);
}

.callout-warning {
  background: rgba(255, 149, 0, 0.08);
  border-left: 4px solid var(--warning);
}

.callout-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-text {
  color: #E4E4E7;
  font-size: 0.95rem;
  line-height: 1.6;
}

.callout-text b {
  color: #fff;
  font-weight: 600;
}

/* Mobile Sidebar & Backdrop Toggle */
.mobile-toggle {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-toggle:hover {
  background: rgba(255,255,255,0.05);
}

.mobile-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 98;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sidebar-backdrop.open {
  display: block;
}

/* Footer styling */
.wiki-footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 24px;
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
}

/* Responsive Rules */
@media (max-width: 960px) {
  .wiki-container {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 16px;
  }

  .wiki-sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    width: 290px;
    height: 100vh;
    max-height: 100vh;
    background: #0B0B0E;
    z-index: 99;
    padding: 32px 20px;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0,0,0,0.6);
    border-right: 1px solid var(--border-color);
  }

  .wiki-sidebar.open {
    left: 0;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .search-container {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin-top: 8px;
  }

  .header-container {
    flex-wrap: wrap;
    gap: 12px;
  }

  .article-screen {
    padding: 24px;
  }
}
