/* ============================================================
   Flexible Calendar & Resource Timeline — Documentation Styles
   Shared across all cloud documentation pages
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --primary-color: #0052CC;
  --primary-dark: #0747A6;
  --primary-light: #4C9AFF;
  --secondary-color: #36B37E;
  --text-primary: #172B4D;
  --text-secondary: #5E6C84;
  --text-light: #7A869A;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F4F5F7;
  --bg-dark: #091E42;
  --border-color: #DFE1E6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --gradient-primary: linear-gradient(135deg, #0052CC 0%, #4C9AFF 100%);
}

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background: var(--bg-secondary);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Fixed Header (injected by components.js) --- */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 40px; height: 40px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px;
}

.nav-links {
  display: flex; gap: 32px; align-items: center; list-style: none;
}
.nav-links a {
  color: var(--text-secondary); text-decoration: none;
  font-weight: 500; font-size: 15px; transition: color 0.3s ease;
}
.nav-links a:hover { color: var(--primary-color); }

.dropdown { position: relative; }
.dropdown-toggle { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.dropdown-content {
  position: absolute; top: 100%; left: 0;
  background: white; border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 8px; min-width: 240px;
  opacity: 0; visibility: hidden; transform: translateY(-10px);
  transition: all 0.3s ease; margin-top: 12px;
}
.dropdown:hover .dropdown-content { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-content a { display: block; padding: 12px 16px; border-radius: 8px; transition: background 0.2s ease; }
.dropdown-content a:hover { background: var(--bg-secondary); }

/* --- Page Header (gradient hero) --- */
.page-header {
  padding: 140px 0 60px;
  background: var(--gradient-primary);
  color: white;
  text-align: center;
}
.page-header h1 { font-size: 48px; font-weight: 800; margin-bottom: 16px; }
.page-header p { font-size: 18px; opacity: 0.95; max-width: 700px; margin: 0 auto; }

/* --- Docs Layout (Monday.com-style sidebar + content grid) --- */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  max-width: 1400px;
  margin: -40px auto 60px;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* --- Sidebar --- */
.docs-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

.sidebar-nav {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.sidebar-nav ul { list-style: none; }
.sidebar-nav ul li { margin-bottom: 1px; }

.sidebar-nav ul li a {
  display: flex; align-items: center; gap: 0;
  padding: 8px 10px; border-radius: 6px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13.5px; font-weight: 500; line-height: 1.3;
  transition: all 0.2s ease;
}

.sidebar-nav ul li a i {
  flex-shrink: 0; width: 18px; text-align: center;
  margin-right: 8px; font-size: 12px; color: var(--text-light);
}

.sidebar-nav ul li a:hover {
  background: var(--bg-secondary); color: var(--primary-color);
}
.sidebar-nav ul li a:hover i { color: var(--primary-color); }

.sidebar-nav ul li a.active {
  background: rgba(0, 82, 204, 0.1);
  color: var(--primary-color); font-weight: 600;
}
.sidebar-nav ul li a.active i { color: var(--primary-color); }

/* Support & extra links at bottom of page nav */
.sidebar-nav .support-links {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
.sidebar-nav .support-links ul li a {
  font-size: 12px; color: var(--text-light);
}
.sidebar-nav .support-links ul li a i {
  font-size: 11px; color: var(--primary-color);
}

/* "On this page" section anchors */
.nav-section {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.nav-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 0 8px 8px;
}

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

.nav-section ul li a {
  display: block;
  padding: 5px 8px 5px 16px;
  border-radius: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px; font-weight: 400; line-height: 1.4;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.nav-section ul li a:hover {
  color: var(--primary-color);
  background: rgba(0, 82, 204, 0.04);
  border-left-color: var(--primary-color);
}

.nav-section ul li a.active {
  color: var(--primary-color); font-weight: 600;
  border-left-color: var(--primary-color);
  background: rgba(0, 82, 204, 0.06);
}

/* --- Main Content Area --- */
.docs-content {
  background: white;
  border-radius: 16px;
  padding: 48px;
  box-shadow: var(--shadow-md);
  min-width: 0;
}

/* Intro section (first block on page) */
.intro-section {
  padding-bottom: 40px;
  border-bottom: 2px solid var(--bg-secondary);
  margin-bottom: 48px;
}
.intro-section h2 { font-size: 32px; font-weight: 800; margin-bottom: 16px; color: var(--text-primary); }
.intro-section p { font-size: 18px; line-height: 1.8; color: var(--text-secondary); }

/* Doc sections */
.doc-section { margin-bottom: 64px; scroll-margin-top: 100px; }

.doc-section h2 {
  font-size: 28px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 24px; display: flex; align-items: center; gap: 12px;
}

.doc-section h3[id] { scroll-margin-top: 100px; }

.section-icon {
  width: 48px; height: 48px;
  background: var(--gradient-primary); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px;
}

.back-to-top {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--primary-color); text-decoration: none;
  font-size: 14px; font-weight: 600;
  margin-left: auto; padding: 8px 16px; border-radius: 8px;
  transition: all 0.2s ease;
}
.back-to-top:hover { background: var(--bg-secondary); }

/* --- Media Elements --- */
.video-container {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
  border-radius: 12px; margin: 24px 0; box-shadow: var(--shadow-md);
}
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

.doc-image {
  max-width: 100%; border-radius: 12px; box-shadow: var(--shadow-md);
  margin: 24px 0; border: 1px solid var(--border-color);
}

/* --- Steps List (numbered) --- */
.steps-list { list-style: none; counter-reset: step-counter; }
.steps-list > li {
  counter-increment: step-counter;
  position: relative; padding-left: 48px; margin-bottom: 24px;
}
.steps-list > li::before {
  content: counter(step-counter);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px;
  background: var(--gradient-primary); color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.steps-list > li strong { color: var(--text-primary); font-weight: 600; }

.sub-steps { list-style: none; margin-top: 16px; margin-left: 0; padding-left: 0; }
.sub-steps li { position: relative; padding-left: 28px; margin-bottom: 12px; color: var(--text-secondary); }
.sub-steps li::before { content: '\2192'; position: absolute; left: 0; color: var(--primary-color); font-weight: 700; }

/* --- Notes & Highlights --- */
.note {
  background: #FFF4E6; border-left: 4px solid #FF991F;
  padding: 16px 20px; border-radius: 8px;
  margin: 16px 0; font-size: 14px; color: #974F0C;
}
.note strong { color: #974F0C; }

.feature-highlight {
  background: linear-gradient(135deg, rgba(0,82,204,0.1) 0%, rgba(76,154,255,0.05) 100%);
  border-left: 4px solid var(--primary-color);
  padding: 20px 24px; border-radius: 8px; margin: 24px 0;
}
.feature-highlight h3 {
  font-size: 18px; font-weight: 700; color: var(--primary-dark);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.feature-highlight p { color: var(--text-secondary); line-height: 1.7; }

/* --- Tables --- */
.source-type-table {
  width: 100%; border-collapse: collapse;
  margin: 24px 0; border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.source-type-table th {
  background: var(--bg-dark); color: white;
  padding: 14px 20px; font-size: 14px; font-weight: 600; text-align: left;
}
.source-type-table td {
  padding: 12px 20px; font-size: 14px;
  border-bottom: 1px solid var(--border-color); color: var(--text-secondary);
}
.source-type-table tr:last-child td { border-bottom: none; }
.source-type-table td:first-child { font-weight: 600; color: var(--text-primary); }

/* --- Scope Cards Grid --- */
.scope-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin: 24px 0;
}
.scope-card {
  background: var(--bg-secondary); border-radius: 10px;
  padding: 16px 20px; text-align: center;
}
.scope-card strong { display: block; font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.scope-card span { font-size: 13px; color: var(--text-secondary); }

/* --- "Need Help?" Block --- */
.need-help {
  background: var(--bg-secondary); padding: 32px; border-radius: 12px;
  margin-top: 48px; text-align: center;
}
.need-help h3 { font-size: 24px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }
.need-help p { color: var(--text-secondary); margin-bottom: 24px; }
.need-help a {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gradient-primary); color: white;
  padding: 12px 32px; border-radius: 8px;
  text-decoration: none; font-weight: 600; transition: transform 0.2s ease;
}
.need-help a:hover { transform: translateY(-2px); }

/* --- Footer (injected by components.js) --- */
footer { background: var(--bg-dark); color: white; padding: 60px 0 30px; }
.footer-content { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 48px; }
.footer-brand h3 { font-size: 24px; font-weight: 800; margin-bottom: 16px; }
.footer-brand p { color: rgba(255,255,255,0.7); line-height: 1.7; margin-bottom: 24px; }
.footer-links h4 { font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.footer-links ul { list-style: none; }
.footer-links ul li { margin-bottom: 12px; }
.footer-links a { color: rgba(255,255,255,0.7); text-decoration: none; transition: color 0.3s ease; font-size: 15px; }
.footer-links a:hover { color: white; }
.footer-bottom {
  padding-top: 32px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px;
}
.footer-bottom p { color: rgba(255,255,255,0.6); font-size: 14px; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: relative; top: auto; max-height: none; }
  .footer-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .page-header h1 { font-size: 36px; }
  .docs-content { padding: 32px 24px; }
  .footer-content { grid-template-columns: 1fr; }
  .scope-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 28px; }
  .doc-section h2 { font-size: 22px; }
  .docs-content { padding: 24px 16px; }
}

/* --- Search Trigger (sidebar) --- */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 13.5px;
  transition: all 0.2s ease;
  background: var(--bg-secondary);
}
.sidebar-search:hover {
  border-color: var(--primary-color);
  color: var(--text-secondary);
  background: white;
}
.sidebar-search i { font-size: 13px; flex-shrink: 0; }
.sidebar-search span { flex: 1; }
.sidebar-search kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  color: var(--text-light);
  line-height: 1;
}

/* --- Search Overlay --- */
.search-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(9, 30, 66, 0.54);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}
.search-overlay.active {
  display: flex;
}

.search-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 640px;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-modal-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
}
.search-modal-header kbd {
  font-family: inherit;
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.2s;
}
.search-modal-header kbd:hover {
  background: var(--border-color);
}

/* --- Pagefind UI Overrides --- */
.pagefind-ui {
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: var(--primary-color);
  --pagefind-ui-text: var(--text-primary);
  --pagefind-ui-background: white;
  --pagefind-ui-border: var(--border-color);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 8px;
  --pagefind-ui-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.pagefind-ui .pagefind-ui__search-input {
  font-size: 16px !important;
  padding: 14px 16px !important;
}

.pagefind-ui .pagefind-ui__result {
  padding: 12px 16px !important;
  border-top: 1px solid var(--bg-secondary) !important;
}

.pagefind-ui .pagefind-ui__result-link {
  color: var(--primary-color) !important;
  font-weight: 600 !important;
}

#pagefindSearch {
  overflow-y: auto;
  padding: 0 4px 8px;
}

#pagefindSearch .pagefind-ui__form::before {
  display: none;
}
