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

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --dark: #1a202c;
  --gray: #718096;
  --light: #f7fafc;
  --border: #e2e8f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background: var(--light);
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.header h1 {
  font-size: 2rem;
  margin-bottom: 0;
  font-weight: 700;
}

.header p {
  font-size: 1.2rem;
  opacity: 0.95;
}

.badges {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  border-bottom: 2px solid var(--border);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  overflow-x: auto;
  gap: 2rem;
}

.nav-link {
  padding: 1rem 0;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  white-space: nowrap;
  font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 3rem;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.sidebar h3 {
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 1.1rem;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 0.5rem;
}

.sidebar a {
  color: var(--gray);
  text-decoration: none;
  transition: color 0.3s;
  display: block;
  padding: 0.5rem;
  border-radius: 5px;
  font-size: 0.95rem;
}

.sidebar a:hover {
  color: var(--primary);
  background: var(--light);
}

/* Main Content */
.content {
  background: white;
  padding: 3rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section {
  margin-bottom: 4rem;
  scroll-margin-top: 100px;
}

.section h2 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  padding-bottom: 0.5rem;
}

.section h3 {
  font-size: 1.8rem;
  margin: 2rem 0 1rem;
  color: var(--dark);
}

.section h4 {
  font-size: 1.3rem;
  margin: 1.5rem 0 1rem;
  color: var(--primary);
}

.section p {
  margin-bottom: 1rem;
  color: var(--gray);
  line-height: 1.8;
}

/* Code Blocks */
.code-block {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.code-block .lang-label {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.code-inline {
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  color: var(--primary);
}

/* Tables */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  min-width: 500px;
}

thead {
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--light);
}

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

.card {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  transition: all 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.card h4 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.card p {
  color: var(--gray);
  margin-bottom: 0;
}

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

.alert-info {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #075985;
}

.alert-success {
  background: #dcfce7;
  border-color: var(--success);
  color: #15803d;
}

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

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

/* Demo Sections */
.demo {
  background: var(--light);
  padding: 2rem;
  border-radius: 8px;
  margin: 2rem 0;
  border: 2px dashed var(--border);
}

.demo-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
  font-weight: 500;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: var(--gray);
}

.btn-secondary:hover {
  background: #4a5568;
}

/* List Styles */
ul,
ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--gray);
}

/* Footer */
.footer {
  background: var(--dark);
  color: white;
  text-align: center;
  padding: 3rem 2rem;
  margin-top: 4rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: white;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.footer-links a:hover {
  opacity: 1;
}

/* Scroll to Top Button */
#scrollTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
  z-index: 1000;
}

#scrollTop:hover {
  transform: scale(1.1);
  background: var(--primary-dark);
}

#scrollTop.show {
  display: flex;
}

/* Syntax Highlighting Colors */
.keyword {
  color: #c678dd;
}
.string {
  color: #98c379;
}
.comment {
  color: #5c6370;
  font-style: italic;
}
.function {
  color: #61afef;
}
.number {
  color: #d19a66;
}

/* Responsive - Tablet (1024px and below) */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    padding: 2rem 1.5rem;
    gap: 2rem;
  }

  .sidebar {
    position: relative;
    top: 0;
    padding: 1.5rem;
  }

  .header {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    padding: 1.5rem;
  }

  .badges {
    justify-content: center;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .nav-container {
    padding: 0 1rem;
    gap: 1rem;
  }

  .nav-link {
    font-size: 0.9rem;
    padding: 0.75rem 0;
  }

  .content {
    padding: 2rem;
  }

  .section h2 {
    font-size: 2rem;
  }

  .section h3 {
    font-size: 1.5rem;
  }

  .code-block {
    padding: 1rem;
    font-size: 0.85rem;
  }

  .table-wrapper {
    margin: 1.5rem 0;
    overflow-x: auto;
  }

  table {
    font-size: 0.9rem;
    min-width: 450px;
  }

  th,
  td {
    padding: 0.75rem;
  }
}

/* Responsive - Mobile Landscape/Large Phone (768px and below) */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
    gap: 1rem;
  }

  .header h1 {
    font-size: 1.3rem;
  }

  .badge {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }

  .nav-container {
    padding: 0 0.75rem;
    gap: 0.75rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.6rem 0;
  }

  .container {
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }

  .sidebar {
    padding: 1.5rem;
  }

  .sidebar h3 {
    font-size: 1rem;
  }

  .sidebar a {
    font-size: 0.9rem;
    padding: 0.4rem;
  }

  .content {
    padding: 1.5rem;
  }

  .section {
    margin-bottom: 3rem;
  }

  .section h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }

  .section h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.75rem;
  }

  .section h4 {
    font-size: 1.1rem;
    margin: 1rem 0 0.75rem;
  }

  .section p {
    font-size: 0.95rem;
  }

  .code-block {
    padding: 1rem;
    font-size: 0.8rem;
    margin: 1rem 0;
  }

  .code-inline {
    font-size: 0.85em;
  }

  table {
    font-size: 0.9rem;
    margin: 1.5rem 0;
  }

  th,
  td {
    padding: 0.6rem;
  }

  .card-grid {
    gap: 1.5rem;
    margin: 1.5rem 0;
  }

  .card {
    padding: 1.5rem;
  }

  .card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .alert {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
  }

  .demo {
    padding: 1rem;
    margin: 1.5rem 0;
  }

  .demo-title {
    margin-bottom: 0.75rem;
  }

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

  li {
    font-size: 0.95rem;
  }

  .footer {
    padding: 2rem 1.5rem;
    margin-top: 3rem;
  }

  .footer-links {
    gap: 1.5rem;
    margin-top: 1rem;
  }
}

/* Responsive - Mobile Portrait (480px and below) */
@media (max-width: 480px) {
  .header {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .header h1 {
    font-size: 1.1rem;
    font-weight: 600;
  }

  .badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.65rem;
  }

  .nav {
    border-bottom: 1px solid var(--border);
  }

  .nav-container {
    padding: 0 0.5rem;
    gap: 0.5rem;
  }

  .nav-link {
    font-size: 0.7rem;
    padding: 0.5rem 0;
  }

  .container {
    grid-template-columns: 1fr;
    padding: 0.75rem 0.5rem;
    gap: 1rem;
  }

  .sidebar {
    padding: 1rem;
    border-radius: 8px;
    position: relative;
    top: 0;
  }

  .sidebar h3 {
    font-size: 0.95rem;
  }

  .sidebar ul {
    max-height: 300px;
    overflow-y: auto;
  }

  .sidebar a {
    font-size: 0.8rem;
    padding: 0.3rem;
  }

  .content {
    padding: 1rem;
    border-radius: 8px;
  }

  .section {
    margin-bottom: 2rem;
    scroll-margin-top: 60px;
  }

  .section h2 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--primary);
  }

  .section h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.6rem;
  }

  .section h4 {
    font-size: 1rem;
    margin: 0.8rem 0 0.5rem;
  }

  .section p {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
  }

  .code-block {
    padding: 0.75rem;
    font-size: 0.7rem;
    margin: 0.75rem 0;
    border-radius: 6px;
  }

  .code-block .lang-label {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  .code-inline {
    font-size: 0.8em;
    padding: 0.15rem 0.4rem;
  }

  table {
    font-size: 0.8rem;
    margin: 1rem 0;
    border-radius: 6px;
  }

  th,
  td {
    padding: 0.5rem;
  }

  .card-grid {
    gap: 1rem;
    margin: 1rem 0;
  }

  .card {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
  }

  .card h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .card p {
    font-size: 0.85rem;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .alert {
    padding: 0.6rem 0.75rem;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    border-left: 3px solid;
  }

  .demo {
    padding: 0.75rem;
    margin: 1rem 0;
    border-radius: 6px;
  }

  .demo-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  ul,
  ol {
    margin-left: 1.2rem;
    margin-bottom: 0.75rem;
  }

  li {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  .footer {
    padding: 1.5rem 1rem;
    margin-top: 2rem;
  }

  .footer h3 {
    font-size: 1.1rem;
  }

  .footer p {
    font-size: 0.85rem;
    margin-top: 0.75rem;
  }

  .footer-links {
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .footer-links a {
    font-size: 0.85rem;
  }

  #scrollTop {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}
