/* Extracted inline styles from index.html */

:root {
  --primary-color: #e53935;
  --primary-light: #ff6659;
  --primary-dark: #ab000d;
  --secondary-color: #1976d2;
  --secondary-light: #63a4ff;
  --secondary-dark: #004ba0;
  --accent-color: #ff9800;
  --background-color: #f8fafc;
  --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --surface-color: #ffffff;
  --surface-elevated: #ffffff;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-ternary: #4a5568;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --base-font-size: 16px;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme variables */
body.dark-theme {
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --surface-elevated: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-ternary: #4a5568;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --border-light: #475569;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3),
    0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4),
    0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --background-gradient: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: var(--background-color);
  background-image: radial-gradient(
      circle at 25px 25px,
      rgba(255, 255, 255, 0.2) 2%,
      transparent 0%
    ),
    radial-gradient(
      circle at 75px 75px,
      rgba(255, 255, 255, 0.1) 2%,
      transparent 0%
    );
  background-size: 100px 100px;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  font-size: var(--base-font-size);
}

.container {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
  max-width: 100%;
  /* margin: 0 auto; */
  background-color: var(--surface-color);
  box-shadow: var(--shadow);
}

/* Sidebar Navigation */
.sidebar {
  width: 100%;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: var(--shadow-xl);
  transform: translateX(0);
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  pointer-events: none;
}

.sidebar h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
  text-align: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 15px;
}

.nav-section {
  margin-bottom: 25px;
}

.nav-section h3 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding: 0 16px;
  position: relative;
  z-index: 10;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-section h3::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.6) 100%
  );
  border-radius: 1px;
}

.nav-item {
  display: block;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  border-radius: var(--border-radius);
  margin-bottom: 6px;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 10;
  font-weight: 500;
  overflow: hidden;
  width: 100%;
  text-align: left;
  font-size: 0.9rem;
}

.nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.6s;
}

.nav-item:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  color: white;
  transform: translateX(6px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-lg);
}

.nav-item:hover::before {
  left: 100%;
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.15) 100%
  );
  color: white;
  box-shadow: var(--shadow-xl);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(4px);
  font-weight: 600;
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  border-radius: 0 2px 2px 0;
}

.nav-item .badge {
  background-color: var(--accent-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-left: auto;
  display: inline-block;
}

/* Toolbar */
.toolbar-wrapper {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  /* background: rgba(255, 255, 255, 0.15); */
  border-radius: var(--border-radius-lg);
  /* -webkit-backdrop-filter: blur(20px); */
  /* backdrop-filter: blur(20px); */
  border: 1px solid rgba(255, 255, 255, 0.2);
  /* box-shadow: var(--shadow-lg); */
  position: relative;
  z-index: 10;
}

.toolbar-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border-radius: var(--border-radius-lg);
  pointer-events: none;
}

.toolbar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius);
  color: white;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.toolbar-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

.toolbar-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.2) 100%
  );
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.4);
}

.toolbar-btn:hover::before {
  left: 100%;
}

.toolbar-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.toolbar-btn svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Font Controls */
.font-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.font-controls .toolbar-btn {
  flex: 1;
  min-width: 60px;
}

/* Control Center Accordion */
.control-center {
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.control-center-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.control-center-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.control-center-toggle svg {
  width: 18px;
  height: 18px;
}

.control-center-toggle .chevron {
  transition: transform 0.3s ease;
}

.control-center.expanded .chevron {
  transform: rotate(180deg);
}

.control-center-content {
  max-height: 0;
  /* padding: 12px; */
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
}

.control-center.expanded .control-center-content {
  max-height: 100%;
  padding: 12px;
}

.control-section {
  margin-bottom: 20px;
}

.control-section:last-child {
  margin-bottom: 0;
}

.control-section h4 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.08) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  color: white;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.control-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.6s;
}

.control-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.15) 100%
  );
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.3);
}

.control-btn:hover::before {
  left: 100%;
}

.control-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.control-section .font-controls {
  display: flex;
  gap: 8px;
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.control-section .toolbar-wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Main Content */
.main-content {
  padding: 30px;
  overflow-y: auto;
  background: linear-gradient(
    135deg,
    var(--surface-color) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
  position: relative;
  min-height: 100vh;
}

.main-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 80%,
      rgba(229, 57, 53, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(229, 57, 53, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(229, 57, 53, 0.02) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: 0;
}

.main-content > * {
  position: relative;
  z-index: 1;
}

.content-header {
  margin-bottom: 30px;
  padding: 30px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.7) 100%
  );
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.content-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color) 0%,
    var(--primary-light) 50%,
    var(--primary-color) 100%
  );
}

.content-header h1 {
  color: var(--primary-color);
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.spinner {
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin-right: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error {
  background-color: #f8d7da;
  color: #721c24;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #f5c6cb;
  margin: 20px 0;
}

/* Markdown Content Styles */
.markdown-content {
  max-width: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  margin-bottom: 30px;
}

@media screen and (max-width: 1024px) {
  .markdown-content {
    padding: 6px;
  }
  .markdown-content pre {
    padding: 6px !important;
  }
}

.markdown-content h1 {
  color: var(--primary-color);
  font-size: 2.2rem;
  margin: 30px 0 20px 0;
  padding: 20px 0 15px 0;
  border-bottom: 3px solid transparent;
  background: linear-gradient(
      90deg,
      var(--primary-color) 0%,
      var(--primary-light) 100%
    )
    bottom / 100% 3px no-repeat;
  position: relative;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-content h1::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 60px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color) 0%,
    var(--primary-light) 100%
  );
  border-radius: 2px;
}

.markdown-content h2 {
  color: var(--secondary-color);
  font-size: 1.8rem;
  margin: 25px 0 15px 0;
  padding: 15px 20px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0.6) 100%
  );
  border-radius: var(--border-radius);
  border-left: 4px solid var(--secondary-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.markdown-content h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(
    180deg,
    var(--secondary-color) 0%,
    var(--secondary-light) 100%
  );
}

.markdown-content h3 {
  color: var(--accent-color);
  font-size: 1.4rem;
  margin: 20px 0 10px 0;
  padding: 10px 15px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(255, 255, 255, 0.5) 100%
  );
  border-radius: var(--border-radius-sm);
  border-left: 3px solid var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.markdown-content h4 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin: 15px 0 8px 0;
  font-weight: 600;
}

.markdown-content p {
  margin-bottom: 15px;
  line-height: 1.7;
}

.markdown-content ul,
.markdown-content ol {
  margin: 15px 0;
  padding-left: 30px;
}

.markdown-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.dark-theme .markdown-content li a {
  color: #c3c3c3 !important;
}

.markdown-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding: 20px 25px;
  margin: 25px 0;
  background: linear-gradient(
    135deg,
    rgba(229, 57, 53, 0.05) 0%,
    rgba(229, 57, 53, 0.02) 100%
  );
  border-radius: var(--border-radius);
  font-style: italic;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(229, 57, 53, 0.1);
  position: relative;
  overflow: hidden;
}

.markdown-content blockquote::before {
  content: '"';
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 3rem;
  color: var(--primary-color);
  opacity: 0.2;
  font-family: serif;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.markdown-content th,
.markdown-content td {
  padding: 15px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.markdown-content th {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
}

.markdown-content th::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary-light) 0%,
    var(--primary-color) 50%,
    var(--primary-light) 100%
  );
}

.markdown-content tr:hover {
  background: linear-gradient(
    135deg,
    rgba(229, 57, 53, 0.05) 0%,
    rgba(229, 57, 53, 0.02) 100%
  );
  transform: translateY(-1px);
  transition: var(--transition);
}

/* Code Blocks */
.markdown-content pre {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  border-radius: var(--border-radius);
  padding: 25px;
  margin: 25px 0;
  overflow-x: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.markdown-content pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color) 0%,
    var(--secondary-color) 50%,
    var(--accent-color) 100%
  );
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.markdown-content code {
  font-family: "Fira Code", "Consolas", "Monaco", monospace;
  font-size: 0.9rem;
}

.markdown-content p code {
  background: linear-gradient(
    135deg,
    rgba(229, 57, 53, 0.1) 0%,
    rgba(229, 57, 53, 0.05) 100%
  );
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  color: var(--primary-color);
  font-weight: 600;
  border: 1px solid rgba(229, 57, 53, 0.2);
  box-shadow: var(--shadow-sm);
}

/* Prism.js customizations - minimal to preserve 'coy' theme */
pre[class*="language-"] {
  margin: 20px 0 !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow) !important;
  /* Remove any background/color overrides to let 'coy' theme work */
}
/* Ensure 'coy' theme colors are preserved */
pre[class*="language-"] code[class*="language-"] {
  background: inherit !important;
  color: inherit !important;
}

/* Search functionality */
.search-container {
  margin-bottom: 20px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 75px 12px 15px;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-icon {
  position: absolute;
  right: 45px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
}

.search-clear:hover {
  color: var(--primary-color);
  background: var(--border-light);
}

.search-input:not(:placeholder-shown) + .search-icon + .search-clear {
  opacity: 1;
  visibility: visible;
}

/* Table of Contents */
.toc {
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.toc h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

.toc ul {
  list-style: none;
  padding-left: 0;
}

.toc li {
  margin-bottom: 8px;
}

.toc a {
  color: var(--accent-color);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.toc a:hover {
  background-color: var(--border-color);
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  /* position: fixed; */
  /* top: 20px; */
  /* left: 20px; */
  z-index: 1002;
  background: transparent;
  /* background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  ); */
  color: var(--text-primary);
  border: none;
  /* border-radius: 50%; */
  width: 48px;
  height: 48px;
  opacity: 1;
  cursor: pointer;
  /* box-shadow: var(--shadow-lg); */
  transition: var(--transition);
  /* -webkit-backdrop-filter: blur(20px); */
  /* backdrop-filter: blur(20px); */
  /* border: 2px solid rgba(255, 255, 255, 0.2); */
}

.mobile-menu-btn::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: transparent;
  /* background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.1) 100%
  ); */
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-menu-btn:hover {
  /* background: linear-gradient(
    135deg,
    var(--primary-light) 0%,
    var(--primary-color) 100%
  ); */
  /* transform: scale(1.05); */
  /* box-shadow: var(--shadow-xl), 0 0 20px rgba(229, 57, 53, 0.4); */
  opacity: 0.8;
}

.mobile-menu-btn.active {
  /* transform: scale(1.05); */
}

.mobile-menu-btn.active svg {
  transform: rotate(180deg);
}

.mobile-menu-btn svg {
  transition: transform 0.3s ease;
}

.mobile-menu-btn:hover::before {
  opacity: 0;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
  transition: var(--transition);
}

#desktop-sidebar {
  display: block;
  width: 300px;
  flex-shrink: 0;
}

#mobile-sidebar {
  z-index: 1010;
  display: none;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  #desktop-sidebar {
    display: none;
  }

  #mobile-sidebar {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 40%;
    z-index: 1001;
    transform: translateX(-100%);
    transition: var(--transition);
    box-shadow: none;
  }

  .sidebar.active {
    transform: translateX(0);
    box-shadow: var(--shadow-xl), 20px 0 40px rgba(0, 0, 0, 0.3);
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border: none;
    /* top: 51px; */
  }

  .sidebar h1 {
    font-size: 1.3rem;
    margin-bottom: 20px;
  }

  .nav-section {
    margin-bottom: 15px;
  }

  .main-content {
    padding: 20px 15px;
    width: 100%;
    min-height: calc(100vh - 40px);
    overflow-x: hidden;
  }

  #contentArea {
    width: 100%;
    min-height: 200px;
    display: block !important;
    visibility: visible !important;
  }

  .content-header h1 {
    font-size: 2rem;
  }

  /* Overlay for mobile sidebar */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

@media screen and (max-width: 480px) {
  .sidebar {
    width: 80%;
  }

  #desktop-sidebar {
    display: none;
  }

  #mobile-sidebar {
    display: block;
  }

  .mobile-menu-btn {
    width: 48px;
    height: 48px;
    border: none;
    /* top: 78px; */
    left: 16px;
    z-index: 1002;
  }

  .mobile-menu-btn svg {
    width: 24px;
    height: 24px;
  }

  .main-content {
    margin-top: 0;
    padding: 80px 16px 16px 16px;
  }

  .container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }

  .toolbar-wrapper {
    flex-direction: column;
    gap: 8px;
  }

  .toolbar-btn {
    flex-direction: row;
    gap: 8px;
    justify-content: center;
  }
}

/* Enhanced Table of Contents Styles */
.toc {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.toc h3 {
  color: var(--primary-color);
  font-size: 1.2rem;
  margin-bottom: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.toc li {
  margin: 8px 0;
}

.toc a {
  color: var(--text-color);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  display: block;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.toc a:hover {
  background: rgba(var(--primary-rgb), 0.1);
  border-left-color: var(--primary-color);
  transform: translateX(5px);
  color: var(--primary-color);
}

/* Hide generated TOC if markdown has its own */
.markdown-content .generated-toc {
  display: none;
}

.markdown-content h3:first-child + ul,
.markdown-content h3:first-child + ol {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Print Styles */
@media print {
  .sidebar {
    display: none;
  }

  .fab-button {
    display: none;
  }

  .sticky-question {
    display: none;
  }

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

  .main-content {
    padding: 0;
  }

  pre[class*="language-"] {
    background-color: #f8f9fa !important;
    color: #000 !important;
    border: 1px solid #ccc;
  }

  /* Preserve token colors in print */
  .token {
    color: #000 !important;
  }

  /* Hide TOC backgrounds in print */
  .toc,
  .markdown-content h3:first-child + ul,
  .markdown-content h3:first-child + ol {
    background: none !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* FAB Button */
.fab-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  background: var(--primary-color, #667eea);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 999;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  /* opacity: 0; */
  transform: translateY(20px);
  /* pointer-events: none; */
}

.fab-button.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.fab-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Sticky Question Header */
.sticky-question {
  position: fixed;
  top: 0;
  left: 300px;
  right: 0;
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  z-index: 999;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  /* transform: translateY(-100%); */
  transition: transform 0.3s ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.sticky-question.show {
  transform: translateY(0);
}

@media (max-width: 1024px) {
  .sticky-question {
    left: 0;
    /* top: 100px; */
  }

  .fab-button {
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
}

/* Code block improvements */
.markdown-content pre {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  margin: 16px 0;
  padding: 16px;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: 1;
  transition: all 0.2s ease;
  z-index: 10;
}

.copy-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* Hide any other copy buttons */
.markdown-content pre .copy-button {
  display: none !important;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.9) 100%
  );
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 0;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl), 0 25px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  padding: 20px 25px;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.modal-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 100%
  );
  pointer-events: none;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-content p {
  padding: 20px 25px 15px;
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.color-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  padding: 0 25px 25px;
}

.color-option {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-md);
}

.color-option::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.3),
    rgba(255, 255, 255, 0.1)
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.color-option:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 0, 0, 0.2);
}

.color-option:hover::before {
  opacity: 1;
}

.color-option.selected {
  border-color: white;
  transform: scale(1.15);
  box-shadow: var(--shadow-xl), 0 0 25px rgba(0, 0, 0, 0.3);
}

.color-option.selected::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Dark mode modal styles */
body.dark-mode .modal-content {
  background: linear-gradient(
    135deg,
    rgba(45, 55, 72, 0.95) 0%,
    rgba(26, 32, 44, 0.9) 100%
  );
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-content p {
  color: var(--text-primary);
}

.toolbar .copy-to-clipboard-button {
  padding: 8px !important;
  cursor: pointer;
}

.hide-zindex {
  /* opacity: 0; */
  z-index: 1;
}

/* Loading Screen Styles */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease-out;
}

.loading-container {
  text-align: center;
  color: white;
  max-width: 400px;
  padding: 2rem;
}

.loading-logo {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
}

.loading-icon {
  color: white;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.loading-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.025em;
}

.loading-subtitle {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 2rem;
  font-weight: 400;
}

.loading-progress {
  margin-bottom: 2rem;
}

.loading-bar {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.loading-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 1) 50%,
    rgba(255, 255, 255, 0.8) 100%
  );
  border-radius: 2px;
  animation: loadingProgress 2s ease-in-out infinite;
  transform-origin: left;
}

@keyframes loadingProgress {
  0% {
    transform: scaleX(0);
  }
  50% {
    transform: scaleX(0.7);
  }
  100% {
    transform: scaleX(1);
  }
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loadingDots {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Dark theme loading screen */
.dark-theme .loading-screen {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

/* Search No Results Styles */
.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
  margin-top: 1rem;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.no-results-content {
  color: rgba(255, 255, 255, 0.8);
}

.no-results-content svg {
  margin-bottom: 1rem;
  opacity: 0.6;
}

.no-results-content h4 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
}

.no-results-content p {
  font-size: 0.9rem;
  opacity: 0.7;
  line-height: 1.4;
}

/* Dark theme search no results */
.dark-theme .search-no-results {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}
