/* =========================================
   DevNotes – W3Schools-style Notes Portal
   ========================================= */

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

:root {
  --font-main: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Brand Colors */
  --brand-green:   #04AA6D;
  --brand-green-d: #029e64;
  --brand-blue:    #282A35;
  --brand-blue-l:  #3b3d4f;

  /* Subject palette */
  --c-color:       #5c6bc0;
  --cpp-color:     #00838f;
  --html-color:    #e65100;
  --css-color:     #1565c0;
  --js-color:      #f9a825;
  --python-color:  #2e7d32;
  --django-color:  #0d5c34;
  --api-color:     #6a1b9a;
  --react-color:   #0288d1;
  --node-color:    #33691e;
  --sql-color:     #bf360c;
  --dsa-color:     #ad1457;

  /* Layout */
  --sidebar-w: 280px;
  --topbar-h:  52px;

  /* Typography */
  --text-primary:   #1a1a2e;
  --text-secondary: #5c5f72;
  --text-code:      #c0392b;

  /* Surfaces */
  --bg-page:    #f9fafb;
  --bg-sidebar: #ffffff;
  --bg-content: #ffffff;
  --bg-code:    #f4f6f8;
  --border:     #e2e5ec;

  /* Misc */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* =========================================
   HOME PAGE
   ========================================= */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Home Nav ---- */
.home-nav {
  background: var(--brand-blue);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.home-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  font-size: 22px;
  color: var(--brand-green);
  font-weight: 700;
  letter-spacing: -1px;
}
.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -.3px;
}
.nav-tagline {
  font-size: 13px;
  color: rgba(255,255,255,.5);
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--brand-blue) 0%, #1e2038 60%, #16213e 100%);
  padding: 72px 24px;
  text-align: center;
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 20px;
}
.hero-accent {
  color: var(--brand-green);
}
.hero-subtitle {
  font-size: 17px;
  color: rgba(255,255,255,.65);
  line-height: 1.7;
}

/* ---- Subjects Section ---- */
.subjects-section {
  flex: 1;
  padding: 56px 24px;
}
.subjects-inner { max-width: 1100px; margin: 0 auto; }
.section-heading {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
}

/* ---- Subject Grid ---- */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.subject-card {
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px 22px;
  cursor: pointer;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.subject-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--card-color, var(--brand-green));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--card-color, var(--brand-green));
}
.subject-card-icon {
  font-size: 38px;
  margin-bottom: 12px;
  display: block;
  line-height: 1;
}
.subject-card-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.subject-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
}
.subject-card-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--card-color, var(--brand-green)) 12%, transparent);
  color: var(--card-color, var(--brand-green));
}

/* ---- Home Footer ---- */
.home-footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

/* =========================================
   NOTES PAGE
   ========================================= */
.notes-page {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.notes-page.hidden { display: none; }
.home-page.hidden { display: none; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: transform var(--transition);
  position: relative;
  z-index: 50;
}
.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  position: absolute;
}

.sidebar-top {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--brand-blue);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
}
.back-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.85);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.back-btn:hover { background: rgba(255,255,255,.2); }
.sidebar-subject-name {
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-search {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.sidebar-search input:focus {
  border-color: var(--brand-green);
  background: #fff;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #d0d3de; border-radius: 4px; }

/* Chapter group */
.nav-chapter {
  margin-bottom: 4px;
}
.nav-chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 16px 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.nav-chapter-header:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}
.nav-chapter-header .chevron {
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
}
.nav-chapter.open .chevron {
  transform: rotate(90deg);
}
.nav-chapter-topics {
  overflow: hidden;
}
.nav-chapter:not(.open) .nav-chapter-topics {
  display: none;
}

.nav-topic-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px 8px 24px;
  font-size: 13.5px;
  font-family: var(--font-main);
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  line-height: 1.4;
}
.nav-topic-btn:hover {
  background: #f0f2f8;
  color: var(--brand-blue);
}
.nav-topic-btn.active {
  background: color-mix(in srgb, var(--subject-color, var(--brand-green)) 10%, transparent);
  border-left-color: var(--subject-color, var(--brand-green));
  color: var(--subject-color, var(--brand-green));
  font-weight: 600;
}

/* ---- Notes Layout ---- */
.notes-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

/* ---- Top Bar ---- */
.notes-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg-page); }

.topbar-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  overflow: hidden;
}
#topbarSubject {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.breadcrumb-sep { color: var(--text-secondary); }
#topbarTopic {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions { display: flex; gap: 6px; }
.topbar-nav-btn {
  padding: 5px 12px;
  font-size: 13px;
  font-family: var(--font-main);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition);
}
.topbar-nav-btn:hover {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}
.topbar-nav-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---- Notes Content ---- */
.notes-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.notes-content::-webkit-scrollbar { width: 6px; }
.notes-content::-webkit-scrollbar-thumb { background: #d0d3de; border-radius: 4px; }

.notes-body {
  max-width: 820px;
  margin: 0 auto;
  padding: 36px 48px 40px;
}

/* --- Notes Typography --- */
.notes-body h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 3px solid var(--subject-color, var(--brand-green));
  padding-bottom: 12px;
  margin-bottom: 24px;
  margin-top: 0;
}
.notes-body h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-top: 36px;
  margin-bottom: 16px;
  scroll-margin-top: 60px;
}
.notes-body h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-blue);
  margin-top: 26px;
  margin-bottom: 10px;
  scroll-margin-top: 60px;
}
.notes-body h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 18px;
  margin-bottom: 8px;
}
.notes-body p { margin-bottom: 14px; }
.notes-body ul, .notes-body ol {
  margin-bottom: 14px;
  padding-left: 22px;
}
.notes-body li { margin-bottom: 6px; }
.notes-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* Inline code */
.notes-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: #eff1f8;
  color: #c0392b;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Code block */
.notes-body pre {
  background: #1e2038;
  color: #e8eaf0;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 16px 0 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  position: relative;
}
.notes-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Blockquote / note */
.notes-body blockquote {
  border-left: 4px solid var(--subject-color, var(--brand-green));
  background: color-mix(in srgb, var(--subject-color, var(--brand-green)) 7%, #fff);
  padding: 14px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 16px 0;
}
.notes-body blockquote p { margin: 0; }

/* Simple Concept Callout Box */
.simple-concept-box {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 4px solid #eab308;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0 24px;
}
.simple-concept-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #854d0e;
  margin-bottom: 8px;
}
.simple-concept-box p {
  color: #713f12;
  margin-bottom: 8px;
  line-height: 1.6;
}
.simple-concept-box p:last-child {
  margin-bottom: 0;
}

/* Tables */
.notes-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 22px;
  font-size: 14px;
}
.notes-body th {
  background: var(--brand-blue);
  color: #ffffff;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
}
.notes-body td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.notes-body tr:nth-child(even) td { background: var(--bg-page); }
.notes-body tr:hover td { background: #f0f4ff; }

/* "Coming Soon" placeholder */
.coming-soon-card {
  text-align: center;
  padding: 80px 40px;
  color: var(--text-secondary);
}
.coming-soon-card .cs-icon { font-size: 56px; margin-bottom: 16px; }
.coming-soon-card h2 { font-size: 22px; color: var(--text-primary); margin-bottom: 8px; }
.coming-soon-card p  { font-size: 15px; }

/* ---- Content Nav Footer ---- */
.content-nav-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 48px 40px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.footer-nav-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-family: var(--font-main);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}
.footer-nav-btn:hover { background: var(--bg-page); }
.footer-nav-btn.primary {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
}
.footer-nav-btn.primary:hover { background: var(--brand-green-d); }
.footer-nav-btn:disabled { opacity: .4; cursor: not-allowed; }


/* =========================================
   SDLC FLOW DIAGRAM STYLES
   ========================================= */
.sdlc-diagram-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 20px 0 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.sdlc-diagram-title {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sdlc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  position: relative;
}
.sdlc-card {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.sdlc-card:hover {
  transform: translateY(-4px);
  border-color: #0288d1;
  box-shadow: var(--shadow-sm);
}
.sdlc-step-num {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #0288d1;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sdlc-icon {
  font-size: 26px;
  margin-bottom: 6px;
  display: block;
}
.sdlc-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.sdlc-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

/* =========================================
   INHERITANCE DIAGRAM STYLES
   ========================================= */
.inh-diagram-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 20px 0 28px;
}
.inh-diagram-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inh-flow-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.inh-type-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.inh-type-card:hover {
  transform: translateY(-3px);
  border-color: #0288d1;
  box-shadow: var(--shadow-sm);
}
.inh-type-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}
.inh-node-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.inh-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
}
.inh-node {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-align: center;
  min-width: 90px;
}
.inh-node.parent {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}
.inh-node.child {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

/* =========================================
   BOX MODEL, FLEXBOX & GRID DIAGRAM STYLES
   ========================================= */
.box-model-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 20px 0 28px;
  display: flex;
  justify-content: center;
}
.bm-margin-layer {
  background: #fef3c7;
  border: 2px dashed #d97706;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  position: relative;
  width: 100%;
  max-width: 480px;
}
.bm-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}
.bm-margin-label { color: #92400e; }
.bm-border-layer {
  background: #fecaca;
  border: 2px solid #dc2626;
  border-radius: 6px;
  padding: 18px;
}
.bm-border-label { color: #991b1b; }
.bm-padding-layer {
  background: #bbf7d0;
  border: 2px dashed #16a34a;
  border-radius: 6px;
  padding: 16px;
}
.bm-padding-label { color: #166534; }
.bm-content-layer {
  background: #bfdbfe;
  border: 2px solid #2563eb;
  border-radius: 4px;
  padding: 14px;
  color: #1e3a8a;
  font-weight: 700;
  font-family: var(--font-mono);
}

.flex-diagram-box {
  background: #1e293b;
  color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 20px 0;
}
.flex-axis-header {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 12px;
  text-align: center;
}
.flex-preview-row {
  display: flex;
  gap: 12px;
  background: #334155;
  padding: 14px;
  border-radius: 6px;
  justify-content: space-around;
  border: 2px dashed #0288d1;
}
.flex-item-card {
  background: #0288d1;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.css-grid-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #0f172a;
  padding: 14px;
  border-radius: 6px;
  margin-top: 10px;
}
.grid-cell {
  background: #2563eb;
  color: #ffffff;
  padding: 16px 8px;
  text-align: center;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}

.inh-arrow-down {
  font-size: 14px;
  color: #64748b;
  font-weight: bold;
}
.inh-code-preview {
  font-size: 11.5px;
  font-family: var(--font-mono);
  background: #f1f5f9;
  padding: 6px 10px;
  border-radius: 4px;
  color: #334155;
  margin-top: 10px;
  width: 100%;
  text-align: left;
}

.sdlc-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #94a3b8;
  font-weight: bold;
}

