/* ============================================================
   RESPONSIVE CSS FRAMEWORK
   Mobile-first approach with breakpoints for tablet/desktop
   ============================================================ */

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Root Variables */
:root {
  --primary-color: #0078d4;
  --primary-dark: #106ebe;
  --secondary-color: #50e6ff;
  --accent-color: #ffc857;
  --text-dark: #1a1a1a;
  --text-light: #666666;
  --bg-light: #f5f5f5;
  --bg-white: #ffffff;
  --border-color: #e0e0e0;
  --success: #107c10;
  --warning: #ff8c00;
  --spacing: 1rem;
}

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

html {
  scroll-behavior: smooth;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-dark);
  font-weight: 600;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.35rem;
}

h4 {
  font-size: 1.15rem;
}

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

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

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

/* Keyboard focus indicator for accessibility */
a:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

button:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

code {
  background-color: var(--bg-light);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #d63384;
}

pre {
  background-color: #2d2d2d;
  color: #f8f8f2;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* Container & Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

.container-sm {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* Header & Navigation */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--spacing);
  flex-wrap: wrap;
  width: 100%;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.logo a {
  color: white;
}

.logo a:hover {
  color: var(--secondary-color);
}

.nav-toggle {
  display: block;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  flex-shrink: 0;
}

.nav-toggle:hover {
  color: var(--secondary-color);
}

nav {
  display: none;
  flex-direction: column;
  width: 100%;
  gap: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--primary-dark);
  padding: 1rem 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

nav.active {
  display: flex;
}

nav a {
  color: white;
  font-weight: 500;
  transition: color 0.3s ease;
  padding: 1rem var(--spacing);
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

nav a:last-child {
  border-bottom: none;
}

nav a:hover {
  color: var(--secondary-color);
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.1);
}

nav a.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--secondary-color);
  border-left: 4px solid var(--secondary-color);
  padding-left: calc(var(--spacing) - 4px);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 3rem var(--spacing) 4rem;
  text-align: center;
}

.hero h1 {
  color: white;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--text-dark);
  border-color: var(--secondary-color);
}

.btn-secondary:hover {
  background-color: #2fd4ff;
  border-color: #2fd4ff;
  text-decoration: none;
}

.btn-outline {
  background-color: transparent;
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
}

.btn-white {
  background-color: white;
  color: var(--primary-color);
  border-color: white;
  font-weight: 700;
}

.btn-white:hover {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

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

/* Cards & Sections */
.card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.card-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.card h3 {
  margin-top: 0;
  color: var(--primary-color);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--spacing);
  grid-template-columns: 1fr;
}

.grid-2 {
  grid-template-columns: 1fr;
}

.grid-3 {
  grid-template-columns: 1fr;
}

/* Main Content Area */
main {
  min-height: calc(100vh - 200px);
  padding: 2rem var(--spacing);
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 3px solid var(--primary-color);
}

.page-header h1 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 2.5rem;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--text-light);
}

/* Sidebar Layout */
.sidebar-layout {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

.sidebar {
  background-color: var(--bg-light);
  padding: 1.5rem;
  border-radius: 8px;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.sidebar h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.sidebar-nav {
  list-style: none;
}

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

.sidebar-nav a {
  display: block;
  padding: 0.5rem;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  border-left-color: var(--primary-color);
  padding-left: 1rem;
  color: var(--primary-color);
  text-decoration: none;
}

/* Demo/Example Boxes */
.demo-box {
  background-color: #e7f3ff;
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 4px;
}

.demo-box strong {
  color: var(--primary-color);
}

.example-section {
  background-color: #f0f9ff;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.example-title {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.example-title::before {
  content: "→";
  font-size: 1.3rem;
}

.prompt-input,
.prompt-output {
  background-color: white;
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
}

.prompt-label {
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
}

/* Lists */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

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

.checklist {
  list-style: none;
  margin-left: 0;
}

.checklist li {
  padding-left: 1.5rem;
  position: relative;
}

.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: bold;
  font-size: 1.2rem;
}

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

.alert-info {
  background-color: #e7f3ff;
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.alert-success {
  background-color: #eafdf0;
  border-left-color: var(--success);
  color: var(--success);
}

.alert-warning {
  background-color: #fff4e6;
  border-left-color: var(--warning);
  color: var(--warning);
}

/* Footer */
footer {
  background-color: var(--text-dark);
  color: white;
  padding: 2rem var(--spacing) 1rem;
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
}

.footer-content {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: var(--secondary-color);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  display: block;
  margin-bottom: 0.5rem;
}

.footer-section a:hover {
  color: var(--secondary-color);
}

.footer-bottom {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

/* Breadcrumb Navigation */
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--primary-color);
}

.breadcrumb span {
  color: var(--text-light);
}

/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

th {
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

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

/* Utility Classes */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.text-center { text-align: center; }
.text-right { text-align: right; }

.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success); }

.flex { display: flex; }
.flex-gap { gap: 1rem; }

/* Tablet & Desktop Breakpoints */
@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.5rem; }

  .hero {
    padding: 4rem var(--spacing) 5rem;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .nav-toggle {
    display: none;
  }

  header {
    padding: 1rem 0;
  }

  .header-content {
    flex-wrap: nowrap;
  }

  nav {
    display: flex !important;
    flex-direction: row;
    position: static;
    width: auto;
    gap: 2rem;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
  }

  nav a {
    padding: 0;
    display: inline;
    border-bottom: none;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding-bottom: 0.25rem;
  }

  nav a:hover {
    background-color: transparent;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.25rem;
  }

  nav a.active {
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.25rem;
    background-color: transparent;
    border-left: none;
    padding-left: 0;
  }

  .logo {
    font-size: 1.5rem;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .sidebar-layout {
    grid-template-columns: 1fr 300px;
  }

  .footer-content {
    grid-template-columns: repeat(4, 1fr);
  }

  main {
    padding: 3rem 2rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 2rem;
  }

  main {
    padding: 3rem auto;
  }
}

/* Print Styles */
@media print {
  header, footer, nav {
    display: none;
  }

  .skip-link {
    display: none;
  }

  body {
    font-size: 12pt;
  }
}

/* Accessibility: Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
