/* ===== Resactivity Documentation - Main Stylesheet ===== */

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --secondary: #34a853;
  --accent: #f9ab00;
  --bg: #f8f9fa;
  --bg-white: #ffffff;
  --text: #202124;
  --text-light: #5f6368;
  --text-muted: #80868b;
  --border: #dadce0;
  --border-light: #e8eaed;
  --sidebar-bg: #f1f3f4;
  --sidebar-width: 320px;
  --header-height: 64px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
  --radius: 8px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  overflow-x: hidden;
}

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

img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
}

.header-logo span.version {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 12px;
}

.header-search {
  flex: 1;
  max-width: 560px;
  margin: 0 32px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 10px 16px 10px 44px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
  background: var(--bg-white);
}

.header-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1001;
}

.search-results.active { display: block; }

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--primary-light); }
.search-result-item .result-title { font-weight: 600; font-size: 0.95rem; }
.search-result-item .result-chapter { font-size: 0.8rem; color: var(--text-muted); }
.search-result-item .result-excerpt { font-size: 0.85rem; color: var(--text-light); margin-top: 2px; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-menu {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
}

.btn-menu:hover { background: var(--bg); }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 900;
  transition: transform var(--transition);
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 4px;
}

.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 12px 12px 6px;
  font-weight: 600;
}

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

.sidebar-nav li a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-light);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all var(--transition);
  line-height: 1.4;
}

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

.sidebar-nav li a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-nav li a .nav-number {
  font-weight: 600;
  min-width: 28px;
  color: var(--primary);
  font-size: 0.85rem;
}

.sidebar-nav .sub-nav {
  list-style: none;
  padding-left: 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-nav .sub-nav.open { max-height: 2000px; }

.sidebar-nav .sub-nav li a {
  font-size: 0.85rem;
  padding: 5px 12px;
  color: var(--text-muted);
}

.sidebar-nav .sub-nav li a:hover { color: var(--primary); }

/* ===== Main Content ===== */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

/* ===== Typography ===== */
.content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--primary);
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 12px;
}

.content p {
  margin-bottom: 16px;
  color: var(--text);
}

.content ul, .content ol {
  margin: 12px 0 20px 24px;
  list-style: disc;
}

.content li {
  margin-bottom: 6px;
  color: var(--text);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}

.content table td,
.content table th {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.content table tr:nth-child(even) {
  background: var(--bg);
}

.content table tr:hover {
  background: var(--primary-light);
}

.content li .ql-ui {
  display: none;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* ===== Chapter Header ===== */
.chapter-header {
  margin-bottom: 32px;
}

.chapter-number {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

/* ===== Callout boxes ===== */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  border-left: 4px solid;
}

.callout-info {
  background: #e8f0fe;
  border-color: var(--primary);
}

.callout-tip {
  background: #e6f4ea;
  border-color: var(--secondary);
}

.callout-warning {
  background: #fef7e0;
  border-color: var(--accent);
}

.callout-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-info .callout-title { color: var(--primary); }
.callout-tip .callout-title { color: var(--secondary); }
.callout-warning .callout-title { color: #e37400; }

/* ===== Images/Screenshots ===== */
.screenshot {
  margin: 24px 0;
  text-align: center;
}

.screenshot img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 100%;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.screenshot img:hover {
  box-shadow: var(--shadow-lg);
}

.screenshot .caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* ===== Steps ===== */
.step {
  display: flex;
  gap: 16px;
  margin: 20px 0;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

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

.step-content { flex: 1; }
.step-content p { margin-bottom: 8px; }

/* ===== Table ===== */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
}

.content table th,
.content table td {
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--border);
}

.content table th {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.content table tr:nth-child(even) { background: var(--bg); }
.content table tr:hover { background: var(--primary-light); }

/* ===== Navigation Footer ===== */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.page-nav a {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  max-width: 48%;
}

.page-nav a:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  background: var(--primary-light);
}

.page-nav .nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.page-nav .nav-title {
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.page-nav .next { text-align: right; margin-left: auto; }

/* ===== Footer ===== */
.footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  padding: 32px 48px;
  margin-left: var(--sidebar-width);
  font-size: 0.85rem;
}

.footer a { color: rgba(255,255,255,0.9); }
.footer a:hover { color: white; }

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== Image Lightbox ===== */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: pointer;
  padding: 40px;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

/* ===== Home Page ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0d47a1 100%);
  color: white;
  padding: 80px 48px 60px;
  text-align: center;
  border-radius: 0 0 24px 24px;
  margin: -40px -48px 40px;
}

.hero h1 { color: white; border: none; font-size: 2.5rem; padding: 0; margin-bottom: 16px; }
.hero p { color: rgba(255,255,255,0.85); font-size: 1.1rem; max-width: 600px; margin: 0 auto 24px; }

.hero-search {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: none;
  border-radius: 28px;
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
  outline: none;
}

.hero-search .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.chapter-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.chapter-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.chapter-card .card-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.chapter-card .card-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 12px;
  align-self: flex-start;
  margin-bottom: 10px;
}

.chapter-card .card-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 8px;
}

.chapter-card .card-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  flex: 1;
}

.chapter-card .card-sections {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

/* ===== Section Categories (Home) ===== */
.category-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-title .cat-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .footer { margin-left: 0; }
  .btn-menu { display: block; }
  .header-search { margin: 0 16px; }
}

@media (max-width: 768px) {
  .content { padding: 24px 20px 60px; }
  .hero { padding: 40px 20px 32px; margin: -24px -20px 24px; }
  .hero h1 { font-size: 1.8rem; }
  .chapter-grid { grid-template-columns: 1fr; }
  .page-nav { flex-direction: column; }
  .page-nav a { max-width: 100%; }
  .footer-content { flex-direction: column; gap: 8px; text-align: center; }
}

/* ===== Scrollbar ===== */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Print ===== */
@media print {
  .header, .sidebar, .page-nav, .footer, .lightbox { display: none !important; }
  .main { margin-left: 0 !important; margin-top: 0 !important; }
  .content { max-width: 100%; padding: 20px; }
}
