/* Reset & Base */
:root {
  --md-sys-color-primary: #00639b;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #cce5ff;
  --md-sys-color-on-primary-container: #001d32;
  --md-sys-color-secondary: #526070;
  --md-sys-color-secondary-container: #d6e4f7;
  --md-sys-color-background: #f8fafc;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-variant: #f0f4f9; /* Google greyish */
  --md-sys-color-outline: #747775;
  --radius-l: 24px;
  --radius-m: 16px;
  --radius-s: 12px;
  --font-brand: "Google Sans", sans-serif;
  --font-body: "Roboto", sans-serif;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.1), 0 1px 3px 1px rgba(0,0,0,0.05);
  --shadow-2: 0 2px 6px 2px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background-color: var(--md-sys-color-background);
  color: #1f1f1f;
  font-family: var(--font-body);
  line-height: 1.5;
}

h1, h2, h3, .brand-text {
  font-family: var(--font-brand);
}

/* --- App Bar (Top) --- */
.app-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid #e0e3e7;
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
}

.app-bar-start { display: flex; align-items: center; gap: 16px; }
.brand-lockup { display: flex; align-items: center; gap: 8px; font-size: 22px; color: #444746; }
.brand-text { font-weight: 500; color: #1f1f1f; }
.brand-icon { font-size: 28px; color: #fbbc04; /* Folder yellow */ }

.doc-links {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-left: 8px;
  height: 100%;
}
.app-bar-link-block {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-bar-link-block.primary {
  background: rgba(1, 87, 133, 0.9);
  color: #fff;
  border-color: rgba(1, 87, 133, 0.9);
}
.app-bar-link-block.primary:hover {
  background: rgba(1, 87, 133, 1);
  border-color: rgba(1, 87, 133, 1);
}
.app-bar-link-block.ghost {
  background: #ffffff;
  color: #1f1f1f;
  border-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.app-bar-link-block.ghost:hover {
  background: #f4f6fb;
  border-color: #f4f6fb;
}

.search-bar {
  display: flex;
  align-items: center;
  background: #f1f3f4;
  border-radius: 24px;
  padding: 4px 8px;
  width: 100%;
  max-width: 600px;
  transition: background 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
  background: white;
  box-shadow: 0 1px 6px rgba(32,33,36,0.28);
}
.search-bar input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 8px;
  font-size: 16px;
  outline: none;
  font-family: var(--font-body);
}

.icon-btn {
  background: none;
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #444746;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); }
.material-symbols-rounded { font-size: 24px; }

.avatar {
  width: 32px; height: 32px;
  background: #00639b; /* Generic blue avatar */
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 14px;
  margin-left: 8px;
}

/* --- Layout Grid --- */
.main-content {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (max-width: 768px) {
  .main-content {
    padding: 16px;
  }
}
/* Sidebar is hidden by default on small screens, visible on wide if needed, 
   but here we used a Top-Bar approach primarily. 
   We can hide it or make it a drawer. Let's make it a left rail for desktop.
*/
.sidebar {
  position: fixed;
  left: 0; top: 64px; bottom: 0;
  width: 80px; /* Rail style */
  background: var(--md-sys-color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
  gap: 12px;
  display: none; /* Hidden for simplicity in this single-file mock, can enable for responsive */
}
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  body { padding-left: 80px; } /* Make room for rail */
  .app-bar { padding-left: 16px; } /* Restore padding */
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: #444746;
  padding: 12px 0;
  width: 56px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}
.nav-item:hover { background: #f0f4f9; }
.nav-item.active {
  background: #c2e7ff;
  color: #001d35;
}
.nav-item .material-symbols-rounded { font-size: 24px; }

/* --- Sections & Cards --- */
.section-card {
  background: var(--md-sys-color-surface);
  border-radius: var(--radius-l);
  padding: 24px;
  box-shadow: var(--shadow-1);
}
.section-card.full-width { width: 100%; }

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.card-header h2 { margin: 0; font-size: 20px; font-weight: 400; color: #1f1f1f; }
.card-icon { color: var(--md-sys-color-primary); }

.hero-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hero-subtitle {
  margin: 0;
  max-width: 700px;
  color: var(--md-sys-color-secondary);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.hero-link-block {
  padding: 12px 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #111;
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hero-link-block.primary {
  background: rgba(0, 103, 170, 0.95);
  border-color: rgba(0, 103, 170, 0.95);
  color: #fff;
}
.hero-link-block.primary:hover {
  background: rgba(0, 77, 129, 1);
  border-color: rgba(0, 77, 129, 1);
}
.hero-link-block.ghost {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: #111;
}
.hero-link-block.ghost:hover {
  background: rgba(255, 255, 255, 0.4);
}

.action-chips { display: flex; gap: 12px; flex-wrap: wrap; }
.action-chip {
  border: 1px solid #e0e3e7;
  background: #ffffff;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-brand);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.action-chip:hover {
  background: #f8fafd;
  border-color: #c2e7ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.action-chip .material-symbols-rounded { font-size: 20px; color: var(--md-sys-color-primary); }

/* --- Files Grid --- */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.file-card {
  background: #fbfcfe; /* Very light background */
  border: 1px solid #e0e3e7;
  border-radius: var(--radius-m);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.file-card:hover {
  background: #ffffff;
  border-color: #747775;
  box-shadow: var(--shadow-2);
}
.file-card h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 500;
  color: #1f1f1f;
  display: flex;
  justify-content: space-between;
}
.file-card p {
  font-size: 14px;
  color: #5e6062;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-meta-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.mini-tag {
  font-size: 11px;
  background: #e1e3e1;
  padding: 2px 8px;
  border-radius: 4px;
  color: #444746;
  font-weight: 500;
}

/* --- Viewer Page Specifics --- */
.viewer-page { background: #f0f2f5; }
.viewer-header {
  background: white;
  padding: 12px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
}
.viewer-toolbar {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.back-btn {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #444746;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 24px;
  transition: background 0.2s;
}
.back-btn:hover { background: #f1f3f4; }

.file-meta { display: flex; align-items: center; gap: 12px; }
.file-name { font-size: 20px; font-weight: 400; font-family: var(--font-brand); }
.file-icon { font-size: 28px; color: #0b57d0; /* Google Blue */ }

.viewer-content {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 24px;
}

/* Quick Memo */
.quick-memo-card {
  background: linear-gradient(135deg, #e8f0fe 0%, #ffffff 100%);
  border-radius: var(--radius-l);
  padding: 24px;
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-1);
  border: 1px solid #d3e3fd;
}
.memo-icon {
  background: #fff;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #0b57d0;
  box-shadow: 0 2px 8px rgba(11,87,208,0.15);
}
.memo-content h3 { margin: 0 0 8px 0; color: #00639b; font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; }
.memo-content p { margin: 0; font-size: 16px; color: #1f1f1f; font-weight: 500; }

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-card {
  background: white;
  border-radius: var(--radius-m);
  padding: 24px;
  box-shadow: var(--shadow-1);
  margin-bottom: 24px;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; border-bottom: 1px solid #f0f0f0; padding-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 18px; }

/* Sidebar details */
.detail-sidebar { display: flex; flex-direction: column; gap: 24px; }
.info-box ul, .structure-box ul { list-style: none; padding: 0; margin: 0; }
.meta-list li { display: flex; justify-content: space-between; margin-bottom: 12px; border-bottom: 1px dashed #eee; padding-bottom: 8px; }
.label { color: #747775; font-size: 13px; }
.chip-tag {
  background: #c2e7ff; color: #001d35;
  padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
}

.check-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  font-size: 14px;
}
.check-list li::before {
  content: '•';
  color: #0b57d0;
  position: absolute; left: 6px; font-weight: bold;
}

.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.dep-chip {
  background: #f1f3f4;
  color: #1f1f1f;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.dep-chip:hover { border-color: #747775; background: white; }

/* Filter Chips (Index) */
.filter-chips { display: flex; gap: 8px; }
.chip {
  background: transparent; border: 1px solid #747775; color: #444746;
  border-radius: 8px; padding: 6px 16px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { background: rgba(0,0,0,0.04); }
.chip.active {
  background: #c2e7ff; color: #001d35; border-color: transparent;
}

code {
    background: #f5f7f8;
    padding: 2px 6px;
    border-radius: 4px;
    color: #d63384; /* Code pink/red */
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9em;
}
.prose p { margin-bottom: 1em; color: #3c4043; }
.prose h3 { margin-top: 1.5em; font-size: 16px; color: #1f1f1f; }

/* Dependency Map styling */
#dependency-map { background: #f8fafd; border-radius: 16px; border: 1px solid #e0e3e7; }
