/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */
:root {
  /* Colors - Light theme (default) */
  --color-bg: #fafafa;
  --color-bg-elevated: #ffffff;
  --color-bg-muted: #f5f5f5;
  --color-text: #1a1a2e;
  --color-text-muted: #6b6b7b;
  --color-text-light: #9a9aa3;
  --color-primary: #2d2d44;
  --color-primary-hover: #1a1a2e;
  --color-secondary: #ffffff;
  --color-secondary-hover: #f0f0f5;
  --color-border: #e8e8ee;
  --color-border-focus: #2d2d44;
  --color-error: #c0392b;
  --color-success: #27ae60;

  /* Typography - System fonts only (no external dependencies) */
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;

  /* Font sizes - fluid scaling with clamp */
  --fs-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --fs-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.9rem);
  --fs-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --fs-lg: clamp(1.1rem, 1.0rem + 0.5vw, 1.25rem);
  --fs-xl: clamp(1.4rem, 1.2rem + 1vw, 1.75rem);
  --fs-2xl: clamp(2rem, 1.6rem + 2vw, 3rem);
  --fs-3xl: clamp(2.8rem, 2.2rem + 3vw, 4.5rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Layout */
  --container-max: 720px;
  --container-padding: 1.5rem;
  --header-height: 64px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index */
  --z-header: 100;
  --z-modal: 200;
  --z-toast: 300;
}

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

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

ul, ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

::selection {
  background: var(--color-primary);
  color: var(--color-secondary);
}

/* ========================================
   Container & Layout Helpers
   ======================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.section {
  padding: var(--space-4xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-title {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  font-size: var(--fs-base);
  color: var(--color-text-muted);
  font-weight: 300;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-secondary);
  border: 1px solid var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-secondary-hover);
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
}

.btn-full {
  width: 100%;
}

/* ========================================
   Header & Navigation
   ======================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border);
  z-index: var(--z-header);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-menu a {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  padding: var(--space-xs) 0;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-primary);
  transition: width var(--transition-base);
}

.nav-menu a:hover,
.nav-menu a:focus {
  color: var(--color-text);
}

.nav-menu a:hover::after,
.nav-menu a:focus::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.nav-toggle:hover {
  background: var(--color-bg-muted);
}

.hamburger {
  position: relative;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: background var(--transition-fast);
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  transition: transform var(--transition-base);
}

.hamburger::before { top: -7px; }
.hamburger::after { bottom: -7px; }

.nav-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--header-height);
  position: relative;
  overflow: hidden;
}

.hero-content {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.hero-greeting {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  font-weight: 300;
  margin-bottom: var(--space-sm);
  animation: fadeInUp 0.8s ease forwards;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-bottom: var(--space-md);
  animation: fadeInUp 0.8s ease 0.1s forwards;
  opacity: 0;
}

.hero-subtitle {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  font-weight: 300;
  margin-bottom: var(--space-2xl);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInUp 0.8s ease 0.2s forwards;
  opacity: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-3xl);
  animation: fadeInUp 0.8s ease 0.3s forwards;
  opacity: 0;
}

.hero-social {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  animation: fadeInUp 0.8s ease 0.4s forwards;
  opacity: 0;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.social-link:hover {
  color: var(--color-primary);
  background: var(--color-bg-muted);
  transform: translateY(-2px);
}

.hero-scroll {
  position: absolute;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-text-light);
  animation: bounce 2s ease-in-out infinite;
}

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-8px); }
  60% { transform: translateX(-50%) translateY(-4px); }
}

/* ========================================
   About Section
   ======================================== */
.about {
  background: var(--color-bg-elevated);
}

.about-content {
  display: grid;
  gap: var(--space-3xl);
}

.about-text p {
  margin-bottom: var(--space-lg);
  color: var(--color-text-muted);
  font-size: var(--fs-base);
  line-height: 1.8;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.skills-title {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.skill-tag {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.skill-tag:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-bg);
}

/* Skill Categories */
.skill-category {
  width: 100%;
}

.skill-category-title {
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Placeholders for images */
.project-placeholder,
.blog-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--color-text-light);
}

/* Scroll animations */
.project-card,
.blog-card,
.skill-category {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.project-card.animate-in,
.blog-card.animate-in,
.skill-category.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   Projects Section
   ======================================== */
.projects-grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
}

.project-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
}

.project-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.project-image {
  aspect-ratio: 16 / 10;
  background: var(--color-bg-muted);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

/* Project Icon (Lucide) */
.project-icon {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  color: var(--color-primary);
  transition: transform var(--transition-slow);
  z-index: 1;
}

.project-card:hover .project-icon {
  transform: scale(1.1);
}

.project-icon svg {
  width: 40px;
  height: 40px;
}

.project-content {
  padding: var(--space-lg);
}

.project-category {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.project-title {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.project-description {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.project-tech .skill-tag {
  font-size: var(--fs-xs);
  background: var(--color-bg);
  border-color: var(--color-border);
}

.project-links {
  display: flex;
  gap: var(--space-md);
}

.project-link {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: color var(--transition-fast);
}

.project-link:hover {
  color: var(--color-text);
}

.project-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.project-link:hover svg {
  transform: translateX(3px);
}

/* ========================================
   Contact Section
   ======================================== */
.contact {
  background: var(--color-bg-elevated);
}

.contact-form {
  max-width: 560px;
  margin: 0 auto var(--space-3xl);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-base);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-light);
}

.form-group input:hover,
.form-group textarea:hover {
  border-color: var(--color-text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(45, 45, 68, 0.1);
}

.form-group input[aria-invalid="true"],
.form-group textarea[aria-invalid="true"] {
  border-color: var(--color-error);
}

.form-group input[aria-invalid="true"]:focus,
.form-group textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.form-note {
  margin-top: var(--space-md);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  min-height: 1.5em;
}

.form-note.success {
  color: var(--color-success);
}

.form-note.error {
  color: var(--color-error);
}

/* Contact Links */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

.contact-link-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 200px;
}

.contact-link-group h3 {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.contact-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--color-text);
  transition: color var(--transition-fast);
  padding: var(--space-xs) 0;
}

.contact-link:hover {
  color: var(--color-primary);
}

.contact-link svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.contact-link:hover svg {
  color: var(--color-primary);
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
}

.footer-copyright {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: var(--space-xs);
}

.footer-built {
  font-size: var(--fs-xs);
  color: var(--color-text-light);
  text-align: center;
}

/* ========================================
   Responsive - Tablet
   ======================================== */
@media (min-width: 640px) {
  .hero-actions {
    flex-wrap: nowrap;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-content {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ========================================
   Responsive - Desktop
   ======================================== */
@media (min-width: 1024px) {
  :root {
    --container-padding: 2rem;
  }

  .nav-toggle {
    display: none;
  }

  .nav-menu {
    display: flex !important;
    position: static;
    background: none;
    padding: 0;
    box-shadow: none;
    border: none;
  }

  .hero-title {
    font-size: var(--fs-3xl);
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   Mobile Navigation
   ======================================== */
@media (max-width: 1023px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-bg-elevated);
    flex-direction: column;
    padding: var(--space-xl);
    gap: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-menu a {
    font-size: var(--fs-lg);
    padding: var(--space-sm) 0;
    width: 100%;
    text-align: center;
  }
}

/* ========================================
   Dark Theme (Default) - White, Gray, Black palette
   ======================================== */
[data-theme="dark"] {
  --color-bg: #0d0d0d;
  --color-bg-elevated: #1a1a1a;
  --color-bg-muted: #262626;
  --color-text: #fafafa;
  --color-text-muted: #a3a3a3;
  --color-text-light: #737373;
  --color-primary: #ffffff;
  --color-primary-hover: #e5e5e5;
  --color-secondary: #1a1a1a;
  --color-secondary-hover: #262626;
  --color-border: #333333;
  --color-border-focus: #ffffff;
  --color-error: #ff6b6b;
  --color-success: #4ade80;

  /* Menu color tokens - Dark theme defaults */
  --menuFundo: #1a1a1a;
  --menuTexto: #a3a3a3;
  --menuDestaque: #ffffff;
  --menuTexto_selecionado: #ffffff;
  --menuDestaque_selecionado: #ffffff;
  --menuFundo_selecionado: #333333;

  /* Header */
  --header-bg: rgba(26, 26, 26, 0.9);
  --header-border: #333333;
}

/* Light Theme - White, Gray, Black palette */
[data-theme="light"] {
  --color-bg: #fafafa;
  --color-bg-elevated: #ffffff;
  --color-bg-muted: #f5f5f5;
  --color-text: #1a1a1a;
  --color-text-muted: #525252;
  --color-text-light: #a3a3a3;
  --color-primary: #1a1a1a;
  --color-primary-hover: #0d0d0d;
  --color-secondary: #ffffff;
  --color-secondary-hover: #f5f5f5;
  --color-border: #e5e5e5;
  --color-border-focus: #1a1a1a;
  --color-error: #c0392b;
  --color-success: #27ae60;

  /* Menu color tokens - Light theme defaults */
  --menuFundo: #ffffff;
  --menuTexto: #525252;
  --menuDestaque: #1a1a1a;
  --menuTexto_selecionado: #ffffff;
  --menuDestaque_selecionado: #1a1a1a;
  --menuFundo_selecionado: #1a1a1a;

  /* Header */
  --header-bg: rgba(250, 250, 250, 0.9);
  --header-border: #e5e5e5;
}

/* ========================================
   Settings Section
   ======================================== */
.settings {
  background: var(--color-bg-elevated);
}

.settings-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-3xl);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.settings-tab {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.settings-tab:hover {
  color: var(--color-text);
  background: var(--color-bg-muted);
}

.settings-tab.active {
  color: var(--color-primary);
}

.settings-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

.settings-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.settings-panel.active {
  display: block;
}

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

/* ========================================
   System Design Components
   ======================================== */
.system-design-components {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.component-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  overflow: hidden;
}

.component-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.component-header:hover {
  background: var(--color-bg-muted);
}

.component-header:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: -2px;
}

.component-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--color-text);
}

.component-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-primary);
  flex-shrink: 0;
}

.component-chevron {
  width: 20px;
  height: 20px;
  color: var(--color-text-light);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.component-item.open .component-chevron {
  transform: rotate(180deg);
}

.component-content {
  padding: var(--space-lg);
  display: none;
  animation: slideDown 0.3s ease;
}

.component-item.open .component-content {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.component-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

.component-docs {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.component-docs h4 {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
  font-family: var(--font-sans);
}

.component-docs code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-bg-muted);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-primary);
}

.component-docs ul {
  margin-top: var(--space-sm);
  padding-left: var(--space-lg);
  list-style: disc;
}

.component-docs li {
  margin-bottom: var(--space-xs);
}

/* ========================================
   Theme & Colors Section
   ======================================== */
.theme-section {
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-3xl);
  border-bottom: 1px solid var(--color-border);
}

.theme-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.theme-section-title {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.theme-section-desc {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

/* Theme Mode Selector */
.theme-mode-selector {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.theme-mode-option {
  position: relative;
  flex: 1;
  min-width: 140px;
}

.theme-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-mode-card svg {
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.theme-mode-card span {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text);
}

.theme-mode-option:hover .theme-mode-card {
  border-color: var(--color-primary);
  background: var(--color-bg-muted);
}

.theme-mode-option input:checked + .theme-mode-card {
  border-color: var(--color-primary);
  background: var(--color-bg-elevated);
  box-shadow: 0 0 0 3px rgba(45, 45, 68, 0.15);
}

.theme-mode-option input:checked + .theme-mode-card svg {
  color: var(--color-primary);
}

[data-theme="dark"] .theme-mode-option input:checked + .theme-mode-card {
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

[data-theme="dark"] .theme-mode-option input:checked + .theme-mode-card svg {
  color: var(--color-primary);
}

/* Color Tokens Grid */
.color-tokens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.color-token-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all var(--transition-fast);
}

.color-token-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.color-token-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.color-token-name {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-bg-muted);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.color-token-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.color-token-item:hover .color-token-swatch {
  transform: scale(1.05);
}

.color-token-inputs {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  align-items: center;
}

.color-token-input-wrapper {
  position: relative;
}

.color-token-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  padding-left: var(--space-lg);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.color-token-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(45, 45, 68, 0.1);
}

[data-theme="dark"] .color-token-input:focus {
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.color-token-input::placeholder {
  color: var(--color-text-light);
}

.color-token-picker {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}

.color-token-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-token-picker::-webkit-color-swatch {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.color-token-picker::-moz-color-swatch {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.color-token-actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.color-token-btn {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.color-token-btn-reset {
  color: var(--color-text-muted);
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
}

.color-token-btn-reset:hover {
  color: var(--color-error);
  border-color: var(--color-error);
  background: var(--color-bg);
}

.color-token-btn-copy {
  color: var(--color-primary);
  background: var(--color-bg);
  border: 1px solid var(--color-primary);
}

.color-token-btn-copy:hover {
  color: var(--color-secondary);
  background: var(--color-primary);
}

/* Menu Preview */
.menu-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  overflow: hidden;
}

.preview-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  background: var(--menuFundo);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-lg);
}

.preview-brand {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--menuTexto);
  letter-spacing: -0.01em;
}

.preview-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.preview-item {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--menuTexto);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.preview-item:hover {
  color: var(--menuDestaque);
}

.preview-item.active {
  color: var(--menuTexto_selecionado);
  background: var(--menuFundo_selecionado);
}

.preview-item.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--menuDestaque_selecionado);
  border-radius: 50%;
}

/* ========================================
   Data Table & Badges (for System Design previews)
   ======================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table th,
.data-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-elevated);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  color: var(--color-text-muted);
}

.data-table tr:hover td {
  background: var(--color-bg-muted);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background: rgba(39, 174, 96, 0.15);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.badge-warning {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid #f39c12;
}

.badge-error {
  background: rgba(192, 57, 43, 0.15);
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

.badge-info {
  background: rgba(41, 128, 185, 0.15);
  color: #2980b9;
  border: 1px solid #2980b9;
}

/* Tab styles for preview */
.tabs-demo {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-xs);
}

.tab-btn {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.tab-btn:hover {
  color: var(--color-text);
  background: var(--color-bg-muted);
}

.tab-btn.active {
  color: var(--color-primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
}

.tab-panel {
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--color-text-muted);
}

/* ========================================
   Utility Classes
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* Admin toast animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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