/* ============================================================
   Language Community — Design System (css/main.css)
   Paleta oficial + variáveis de layout e componentes
   ============================================================ */

:root {
  /* Paleta Base (infoApp.txt) */
  --bg-dark: #14213d;
  --accent-gold: #fca311;
  --bg-light: #ffffff;
  --surface-gray: #e5e5e5;
  --text-dark: #000000;

  /* Aplicação em Componentes da Interface */
  --header-bg: var(--bg-dark);
  --header-text: var(--bg-light);

  --card-bg: var(--bg-light);
  --card-border: var(--surface-gray);
  --text-primary: var(--text-dark);
  --text-secondary: #4a4a4a;

  /* Elementos de Ação e Destaques */
  --btn-primary-bg: var(--accent-gold);
  --btn-primary-text: var(--bg-dark);

  /* Status Exclusivo */
  --badge-premium-bg: var(--accent-gold);
  --badge-premium-text: var(--bg-dark);

  /* Elementos Interativos (Quizzes / Jogos) */
  --quiz-btn-bg: var(--surface-gray);
  --quiz-btn-hover: var(--accent-gold);
  --quiz-correct: #2ea44f;
  --quiz-incorrect: #d73a49;

  /* Extensões do Design System */
  --bg-deep: #0b1526;
  --accent-gold-soft: rgba(252, 163, 17, 0.15);
  --accent-gold-glow: rgba(252, 163, 17, 0.45);
  --surface-glass: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.12);

  /* Layout Shell */
  --header-height: 64px;
  --sidebar-width: 250px;
  --sidebar-bg: rgba(20, 33, 61, 0.92);
  --content-max: 980px;

  /* Raios, Sombras e Transições */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 12px 30px rgba(11, 21, 38, 0.35);
  --shadow-float: 0 18px 45px rgba(11, 21, 38, 0.45);
  --transition-fast: 180ms ease;
  --transition: 260ms ease;

  /* Tipografia */
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-size-sm: 0.85rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.15rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--bg-light);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(1100px 520px at 82% -12%, rgba(252, 163, 17, 0.14), transparent 60%),
    radial-gradient(900px 600px at -12% 8%, rgba(64, 88, 155, 0.35), transparent 55%),
    radial-gradient(760px 620px at 108% 86%, rgba(88, 60, 160, 0.3), transparent 58%),
    linear-gradient(160deg, var(--bg-dark) 0%, #1b2a52 45%, var(--bg-deep) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
}

a:hover {
  opacity: 0.85;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-gold);
  color: var(--bg-dark);
}

/* ============================================================
   Layout Shell
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---------- Header Principal ---------- */
.main-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-height);
  padding: 0 1.25rem;
  background-color: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 18px rgba(11, 21, 38, 0.35);
}

.main-header__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--header-text);
}

.main-header__logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--accent-gold);
  color: var(--header-bg);
}

.main-header__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hamburger {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  color: var(--header-text);
  background-color: var(--surface-glass);
}

/* ---------- Corpo (Sidebar + Conteúdo) ---------- */
.shell-body {
  position: relative;
  display: flex;
  flex: 1;
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: flex-start;
  width: var(--sidebar-width);
  height: calc(100dvh - var(--header-height));
  padding: 1.25rem 1rem;
  overflow-y: auto;
  background-color: var(--sidebar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--border-subtle);
}

.sidebar__section {
  margin-bottom: 1.75rem;
}

.sidebar__label {
  display: block;
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover {
  background-color: var(--surface-glass);
  color: var(--bg-light);
  opacity: 1;
}

.nav-link.is-active {
  background-color: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.nav-link .nav-link__icon {
  flex-shrink: 0;
}

/* ---------- Área de Conteúdo Dinâmica (htmx) ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 1.75rem 1.25rem;
}

.main-content__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Backdrop do sidebar em móvel */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 0 0;
  z-index: 35;
  background-color: rgba(11, 21, 38, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ============================================================
   Componentes Base
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.btn-dark {
  background-color: var(--bg-dark);
  color: var(--bg-light);
}

.btn-ghost {
  background-color: var(--surface-glass);
  color: var(--bg-light);
  border: 1px solid var(--border-subtle);
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  transform: scale(0.98);
}

.badge-premium {
  display: inline-block;
  background-color: var(--badge-premium-bg);
  color: var(--badge-premium-text);
  font-weight: bold;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card {
  background-color: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

/* Avatar central / utilizador */
.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-dark);
  color: var(--bg-light);
  border: 2px solid var(--border-subtle);
}

.avatar--sm {
  width: 36px;
  height: 36px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Conteúdo temporário (em construção) */
.placeholder {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
}

.placeholder__title {
  margin-top: 1rem;
  font-size: var(--font-size-xl);
  color: var(--bg-light);
}

.placeholder__text {
  margin-top: 0.4rem;
  color: rgba(255, 255, 255, 0.65);
}

.gradient-text {
  background: linear-gradient(92deg, var(--accent-gold), #ffd38a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-gold);
}

/* ============================================================
   Anexos dos módulos (feed / interactive) — placeholder base
   ============================================================ */
.post-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
}

/* ============================================================
   Scrollbars
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================
   Responsividade
   ============================================================ */
@media (max-width: 920px) {
  .hamburger {
    display: grid;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 36;
    height: calc(100dvh - var(--header-height));
    width: min(var(--sidebar-width), 82vw);
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-float);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

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

  .main-content {
    padding: 1.25rem 1rem;
  }
}

@media (max-width: 520px) {
  :root {
    --header-height: 58px;
  }

  .main-header__brand span {
    font-size: 0.95rem;
  }

  .main-content {
    padding: 1rem 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}