/* Reset & basics */
*, *::before, *::after { box-sizing: border-box; margin:0; padding:0; }
html { font-size: 112%; } /* Increased base font size */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #f9fafb;
    color: #222;
    line-height: 1.6;
}
#app {
    display: flex;
    min-height: 100vh;
}
aside {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    width: 180px;
    padding: 0.75rem;
    position: sticky;
    top:0;
    height: 100vh;
    overflow-y:auto;
}
aside h1 { font-size:1.25rem; margin-bottom:0.15rem; }
aside p { color:#6b7280; margin-bottom:0.75rem; font-size:0.8rem; }
#stats div { margin:0.2rem 0; font-size:0.8rem; }
#refresh-btn {
    width:100%; padding:0.4rem; margin-top:0.75rem;
    background:#2563eb; color:#fff; border:none; border-radius:0.3rem;
    cursor:pointer; font-weight:600; font-size:0.8rem;
}
#refresh-btn:hover { background:#1d4ed8; }

main { flex:1; padding:1rem; }
header h1 { font-size:1.5rem; margin-bottom:0.25rem; }
header p { color:#555; max-width:48rem; font-size:0.95rem; }

/* Navigation links */
#sidebar-nav .nav-link {
    display: block;
    padding: 0.35rem 0.6rem;
    margin: 0.2rem 0;
    border-radius: 0.3rem;
    text-decoration: none;
    color: #1f2937;
    font-weight: 500;
    font-size: 0.85rem;
}
#sidebar-nav .nav-link:hover,
#sidebar-nav .nav-link.active {
    background: #eff6ff;
    color: #1d4ed8;
}

/* Filter bar */
#filter-nav {
    display:flex; gap:0.35rem; margin:1rem 0; flex-wrap:wrap;
}
#filter-nav button {
    padding:0.35rem 0.7rem; border:1px solid #d1d5db; background:#fff;
    border-radius:0.3rem; cursor:pointer; font-size:0.85rem;
}
#filter-nav button.active,
#filter-nav button:hover { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }

#columns-nav {
    display:flex; gap:0.35rem; margin:0 0 1rem; flex-wrap:wrap; align-items:center;
}
#columns-nav .col-label { font-size:0.85rem; color:#4b5563; margin-right:0.25rem; }
#columns-nav .col-btn {
    padding:0.35rem 0.7rem; border:1px solid #d1d5db; background:#fff;
    border-radius:0.3rem; cursor:pointer; font-size:0.85rem; min-width:2rem;
}
#columns-nav .col-btn.active,
#columns-nav .col-btn:hover { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }

#legend {
    display:flex; gap:1rem; flex-wrap:wrap; margin-bottom:1rem;
    font-size:0.85rem; color:#4b5563;
}
.leg-item { display:flex; align-items:center; gap:0.25rem; }
.leg-dot {
    width:1rem; height:1rem; border-radius:50%;
    display:inline-block;
}
.leg-dot.not_started { background:#ef4444; }
.leg-dot.in_progress { background:#f59e0b; }
.leg-dot.done { background:#10b981; }

#modules-list {
    display:grid; gap:0.4rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1000px) {
    #modules-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    #modules-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    #modules-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.module-card {
    background:#fff; border:1px solid #e5e7eb; border-radius:0.3rem;
    padding:0.5rem; transition:transform 0.1s ease-in-out, box-shadow 0.1s;
    min-width: 0;
}
.module-card:hover { transform:translateY(-1px); box-shadow:0 1px 4px rgba(0,0,0,0.06); }
.module-card h3 { margin:0 0 0.2rem; font-size:0.85rem; overflow-wrap:break-word; }
.module-card .status {
    font-weight:600; text-transform:uppercase; font-size:0.65rem;
    padding:0.1rem 0.3rem; border-radius:0.2rem; display:inline-block;
    margin-bottom:0.2rem;
}
.module-card .status.not_started { background:#fee2e2; color:#b91c1c; }
.module-card .status.in_progress { background:#fffbeb; color:#92400e; }
.module-card .status.done { background:#dcfce7; color:#166534; }
.module-card .detail { font-size:0.75rem; color:#4b5563; margin-top:0.2rem; line-height:1.25; overflow-wrap:break-word; }

#schematic { margin-top:3rem; }
#schematic h2 { margin-bottom:1rem; font-size:1.75rem; }
.mermaid { text-align:center; }

/* Dependency grid */
.modules-grid { display:flex; flex-direction:column; gap:1.25rem; margin-top:1.5rem; }
.dep-row { display:grid; grid-template-columns: 1fr auto 1fr; gap:1rem; align-items:stretch; }
.dep-cell { min-width:0; }
.dep-link { display:flex; align-items:center; justify-content:center; }
.link-arm { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0.25rem; color:#6b7280; }
.arrow { font-size:1.5rem; line-height:1; color:#2563eb; }
.link-label { font-size:0.8rem; text-transform:uppercase; letter-spacing:0.05em; }
.visible-badge, .invisible-badge { display:inline-block; padding:0.15rem 0.4rem; border-radius:0.25rem; font-size:0.85rem; font-weight:600; }
.visible-badge { background:#dcfce7; color:#166534; }
.invisible-badge { background:#eef2ff; color:#3730a3; }
.section-intro { font-size:1.05rem; color:#374151; margin-bottom:1rem; }
#legend { display:flex; gap:1.5rem; flex-wrap:wrap; margin-bottom:2rem; font-size:1rem; color:#4b5563; }
.leg-item { display:flex; align-items:center; gap:0.3rem; }
.leg-dot { width:1rem; height:1rem; border-radius:50%; display:inline-block; background:#ef4444; }
.leg-dot.done { background:#10b981; }
.leg-dot.in_progress { background:#f59e0b; }
.leg-dot.not_started { background:#ef4444; }
.leg-dot.link { background:#2563eb; }

/* Modal */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}
.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2.5rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 700px;
    position: relative;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.close-btn {
    color: #aaa;
    float: right;
    font-size: 1.75rem;
    font-weight: bold;
}
.close-btn:hover,
.close-btn:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}
.modal h2 {
    margin-top: 0;
    font-size: 1.75rem;
}
.modal ul {
    padding-left: 1.5rem;
}
.modal .mermaid {
    text-align: center;
    background: #f9fafb;
    padding: 1.25rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    min-height: 200px;
}

/* Presentation specific enhancements */
.hero {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    padding: 4rem 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2.5rem;
    text-align: center;
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #1e40af;
}
.hero p {
    font-size: 1.5rem;
    color: #374151;
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
}
.section {
    margin-bottom: 3.5rem;
}
.section h2 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    color: #111827;
    padding-left: 0.5rem;
    border-left: 4px solid #2563eb;
}
.features-grid {
    display: grid;
    gap: 1.75rem;
    margin-top: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.75rem;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.feature-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    color: #1f2937;
}
.feature-card p {
    margin: 0;
    color: #4b5563;
    line-height: 1.5;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 1rem;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
}
tr:hover {
    background-color: #f3f4f6;
}
tr:nth-child(even) {
    background-color: #fafafa;
}
.caption {
    font-size: 0.95rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-style: italic;
}
.getting-started ol {
    padding-left: 1.5rem;
}
.getting-started li {
    margin-bottom: 0.75rem;
}
.code {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
}
.conclusion {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    padding: 2.5rem;
}
.conclusion p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

/* Responsive */
@media (max-width: 768px) {
    #app { flex-direction:column; }
    aside { width:100%; height:auto; position:static; border-right:none; border-bottom:1px solid #e5e7eb; }
    main { padding:1.5rem; }
    .hero { padding:3rem 1rem; }
    .hero h1 { font-size:2.5rem; }
    .hero p { font-size:1.25rem; }
    .section h2 { font-size:2rem; }
    .features-grid { grid-template-columns: 1fr; }
}

/* Improvement icon */
#improvement-icon {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 2.5rem;
  height: 2.5rem;
  background: #2563eb;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 1000;
  transition: background 0.2s ease, transform 0.1s ease;
}
#improvement-icon:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

/* Close button for improvement modal */
.close-improvement {
  color: #aaa;
  float: right;
  font-size: 1.75rem;
  font-weight: bold;
}
.close-improvement:hover,
.close-improvement:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}
    .modal-content { width:95%; max-width:500px; margin:15% auto; }
}
/* Module Grid */
.modules-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    margin-top: 2rem;
}
.module-card .meta {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}
.module-card .meta span {
    margin-right: 0.75rem;
}
.module-card a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.module-card a:hover {
    text-decoration: underline;
}
.card-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}
.card-link {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 0.25rem;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.card-link:hover {
    background: #dbeafe;
    text-decoration: none;
}

/* Resize handles */
.resize-handle {
    width: 6px;
    cursor: col-resize;
    background: #3e3e3e;
    border-left: 1px solid #555;
    border-right: 1px solid #555;
    flex-shrink: 0;
}
.resize-handle:hover, .resize-handle.active {
    background: #0e639c;
    border-color: #1177bb;
}
#resize-left { margin-left: -3px; }
#resize-right { margin-right: -3px; }
