/* ========================================
   CSS Variables
   ======================================== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #10b981;
  --background: #ffffff;
  --surface: #f9fafb;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
}

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
}

code, pre {
  font-family: 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
  border-collapse: collapse;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 2.5rem;
  color: var(--text);
}

h2 {
  font-size: 2rem;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  color: var(--text);
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ========================================
   Layout Components
   ======================================== */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1920px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-button {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text);
  padding: 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  font-size: 1.75rem;
}

.logo-text {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.version-badge {
  background-color: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.github-link {
  padding: 0.5rem 1rem;
  background-color: var(--text);
  color: white;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: background-color 0.2s;
  text-decoration: none;
}

.github-link:hover {
  background-color: var(--primary-dark);
}

/* Layout Body */
.layout-body {
  display: flex;
  flex: 1;
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  position: sticky;
  top: 73px;
  height: calc(100vh - 73px);
}

.sidebar-nav {
  padding: 1.5rem 0;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  padding: 0 1.5rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-badge {
  background-color: var(--secondary);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

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

.nav-link-active {
  background-color: var(--background);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 1.125rem;
  display: flex;
  align-items: center;
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
}

.content-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Mobile Overlay */
.sidebar-overlay {
  display: none;
}

/* ========================================
   Page Components
   ======================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Code Block */
.code-block {
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.code-block-title {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-block pre {
  margin: 0;
  padding: 1rem;
  background-color: var(--code-bg);
  overflow-x: auto;
}

.code-block code {
  color: var(--code-text);
  font-size: 0.875rem;
}

/* Alert */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.alert-success {
  background-color: #d1fae5;
  border-color: var(--success);
  color: #065f46;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: var(--warning);
  color: #92400e;
}

.alert-error {
  background-color: #fee2e2;
  border-color: var(--error);
  color: #991b1b;
}

.alert-info {
  background-color: #dbeafe;
  border-color: var(--info);
  color: #1e40af;
}

/* Home Page Specific */
.hero {
  text-align: center;
  padding: 3rem 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--secondary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.badge-icon {
  font-size: 1.25rem;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-title-highlight {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section {
  margin: 4rem 0;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.step {
  display: flex;
  gap: 1.5rem;
  margin: 2rem 0;
}

.step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.step-content {
  flex: 1;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.feature-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2rem 0;
}

.feature-item {
  padding: 1rem;
  background-color: var(--surface);
  border-radius: 0.5rem;
  border-left: 4px solid var(--primary);
}

.feature-item-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.feature-icon-small {
  font-size: 1.5rem;
}

.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.next-step-card {
  padding: 1.5rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s;
}

.next-step-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.next-step-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Lead paragraph */
.lead {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Flow Diagram */
.flow-diagram {
  margin: 2rem 0;
  padding: 2rem;
  background-color: var(--surface);
  border-radius: 0.5rem;
}

.flow-step {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background-color: var(--background);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.flow-step-number {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
}

.flow-step-content {
  flex: 1;
}

.flow-step-content h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.flow-step-content p {
  margin-bottom: 0.5rem;
}

.flow-step-content .code-block {
  margin-top: 1rem;
  margin-bottom: 0;
}

.flow-step-content .alert {
  margin-top: 1rem;
  margin-bottom: 0;
}

.flow-arrow {
  text-align: center;
  font-size: 2rem;
  color: var(--primary);
  margin: 0.5rem 0;
  font-weight: bold;
}

/* Principle Cards */
.principle-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.principle-card {
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 2px solid;
}

.principle-card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.principle-card ul {
  margin: 0;
  padding-left: 1.5rem;
}

.principle-card li {
  margin-bottom: 0.75rem;
}

.principle-do {
  background-color: #d1fae5;
  border-color: var(--success);
}

.principle-do h3 {
  color: #065f46;
}

.principle-do li {
  color: #047857;
}

.principle-dont {
  background-color: #fee2e2;
  border-color: var(--error);
}

.principle-dont h3 {
  color: #991b1b;
}

.principle-dont li {
  color: #b91c1c;
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (min-width: 768px) {
  .logo-text {
    display: inline;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 73px;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 50;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  }

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

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    top: 73px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .mobile-menu-button {
    display: block;
  }

  .content-wrapper {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  p, li {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  ul, ol {
    padding-left: 1.5rem;
  }
}

@media (max-width: 640px) {
  .header-content {
    padding: 0.75rem 1rem;
  }

  .github-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }

  .content-wrapper {
    padding: 1.5rem 1rem;
  }

  .step {
    flex-direction: column;
  }

  .hero-stats {
    gap: 2rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .flow-step {
    flex-direction: column;
  }

  .flow-step-number {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }

  .principle-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.375rem;
  }

  h3 {
    font-size: 1.125rem;
  }

  body {
    font-size: 0.9375rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }
}
