/* assets/style.css */

/* 1. VARIABLES & THEME */
:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --text-primary: #f8fafc;
  --text-dim: #94a3b8;
  --border: #334155;
  --code-bg: #0a0f1a;
  
  /* Module Colors */
  --accent: #0ea5e9;       /* Default / DAX (Blue) */
  --accent-excel: #22c55e; /* Excel (Green) */
  --accent-sql: #a855f7;   /* SQL (Purple) */
  --accent-m: #f59e0b;     /* M Language (Yellow) */
  --accent-hover: #0284c7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
  background: var(--bg-main); color: var(--text-primary);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh;
}

/* 2. HEADER & NAVIGATION */
header {
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.brand-area { display: flex; align-items: center; gap: 0.5rem; }
.brand-icon { font-size: 1.5rem; color: var(--accent); }
.brand-text { font-weight: 800; font-size: 1.1rem; color: #fff; }

.nav-group { display: flex; gap: 0.8rem; }

.nav-link { 
  text-decoration: none; font-size: 0.85rem; padding: 0.4rem 0.8rem;
  border-radius: 0.5rem; transition: 0.2s; display: flex; align-items: center; gap: 0.4rem;
  border: 1px solid transparent;
}

/* Dynamic Module Buttons */
.nav-dax { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; border-color: rgba(14, 165, 233, 0.2); }
.nav-dax:hover { background: rgba(14, 165, 233, 0.2); transform: translateY(-1px); }

.nav-excel { background: rgba(34, 197, 94, 0.1); color: #22c55e; border-color: rgba(34, 197, 94, 0.2); }
.nav-excel:hover { background: rgba(34, 197, 94, 0.2); transform: translateY(-1px); }

.nav-sql { background: rgba(168, 85, 247, 0.1); color: #a855f7; border-color: rgba(168, 85, 247, 0.2); }
.nav-sql:hover { background: rgba(168, 85, 247, 0.2); transform: translateY(-1px); }

.nav-m { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border-color: rgba(245, 158, 11, 0.2); }
.nav-m:hover { background: rgba(245, 158, 11, 0.2); transform: translateY(-1px); }

.nav-main { background: transparent; color: var(--text-dim); border-color: var(--border); }
.nav-main:hover { color: #fff; border-color: #fff; }

/* 3. LAYOUT CONTAINERS */
.pageWrapper { width: 100%; max-width: 1200px; margin: 2rem auto; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; padding: 0 1rem; align-items: start; }

.card, .cat-card { 
  background: var(--bg-card); border: 1px solid var(--border); 
  border-radius: 1rem; padding: 1.5rem; 
  display: flex; flex-direction: column; 
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); 
  transition: transform 0.2s; 
  height: auto; 
}
.card { min-height: 600px; }

/* Header Alignment */
.card > div:first-child, .lesson-header {
  display: flex !important; justify-content: space-between !important; align-items: center !important;
  flex-wrap: nowrap !important; gap: 1rem; margin-bottom: 1rem;
}

h2 { margin: 0; color: #fff; font-size: 1.2rem; white-space: normal; line-height: 1.2; max-width: 60%; }

/* 4. VISUALS */
.table-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; padding: 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.header { font-weight: bold; color: var(--accent); border-bottom: 2px solid var(--border); background: rgba(255,255,255,0.03); }
.cell-num { font-family: monospace; }
.row-highlight { background: rgba(34, 197, 94, 0.2); border-left: 3px solid #22c55e; transition: background 0.2s; }

.codeArea { background: var(--code-bg); padding: 1rem; border-radius: 0.5rem; font-family: monospace; color: #d1d5db; line-height: 1.6; font-size: 0.9rem; }
.codeLine { padding: 2px 8px; border-radius: 4px; border-left: 3px solid transparent; }
.codeLine.active { background: #1e3a8a; border-left-color: #60a5fa; }
.kwd { color: #c084fc; } .fn { color: #60a5fa; } .col { color: #facc15; } .cmt { color: #6b7280; font-style: italic; }

/* 5. CONTROLS */
.control-panel { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }
.settings-row { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 0.8rem; margin: 0 !important; flex-shrink: 0; }
.setting-group { display: flex; align-items: center; gap: 0.5rem; background: rgba(255,255,255,0.03); padding: 4px 8px; border-radius: 6px; }
.setting-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; }

.toggle-group { display: flex; background: var(--bg-main); border-radius: 0.4rem; padding: 2px; border: 1px solid var(--border); }
.toggle-opt { padding: 0.2rem 0.5rem; cursor: pointer; border-radius: 0.3rem; font-size: 0.7rem; color: var(--text-dim); user-select: none; }
.toggle-opt.selected { background: var(--border); color: #fff; font-weight: bold; }
.toggle-group.disabled-area { opacity: 0.4; pointer-events: none; filter: grayscale(1); }

.action-btns { display: flex; gap: 0.8rem; }
button.action { flex: 1; background: #334155; color: white; border: 1px solid #475569; padding: 0.6rem; border-radius: 0.5rem; cursor: pointer; font-weight: 500; transition: 0.2s; }
button.action:hover { background: #475569; }
button.primary { background: var(--accent); color: #000; border: none; }
button.primary:hover { background: var(--accent-hover); }

/* 6. ANIMATION ELEMENTS */
.calculation-box { margin-top: 1rem; padding: 1rem; border: 1px dashed var(--border); border-radius: 0.5rem; background: rgba(0,0,0,0.3); font-family: monospace; color: var(--text-dim); min-height: 60px; display: flex; align-items: center; justify-content: center; text-align: center; position: relative; overflow: hidden; }
.progress-track { width: 100%; height: 4px; background: #0f172a; border-radius: 0 0 4px 4px; overflow: hidden; margin-top: -4px; position: relative; z-index: 10; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); }
.total-bubble { background: var(--accent); color: #000; font-weight: bold; padding: 0.5rem 1rem; border-radius: 2rem; margin-left: auto; opacity: 0; transform: scale(0.5); transition: 0.4s; }
.total-bubble.show { opacity: 1; transform: scale(1); }

/* 7. PROGRESS TRACKING */
.status-dot { opacity: 0.3; filter: grayscale(1); transition: 0.3s; }
a.lesson-btn.active { border-color: #22c55e; background: rgba(34, 197, 94, 0.1); color: #fff; }
a.lesson-btn.active:hover { background: rgba(34, 197, 94, 0.2); transform: translateY(-3px); }
a.lesson-btn.active .status-dot { opacity: 1; filter: grayscale(0); }

/* 8. TOAST */
#toast { visibility: hidden; min-width: 250px; background-color: #1e293b; color: #fff; text-align: center; border-radius: 8px; padding: 12px; position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); box-shadow: 0 4px 15px rgba(0,0,0,0.5); border: 1px solid #ef4444; font-size: 0.85rem; }
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 4.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }

/* 9. FOOTER */
footer { text-align: center; padding: 2rem 1rem; color: var(--text-dim); font-size: 0.85rem; border-top: 1px solid var(--border); background: var(--bg-card); margin-top: auto; }
.footer-links a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); margin: 0 0.2rem; transition: 0.2s; }
.footer-links a:hover { color: #fff; border-bottom-style: solid; }
.divider { margin: 0 0.5rem; color: var(--border); }

/* ========================================= */
/* 10. MODULE: EXCEL & SYNTAX STYLES (NEW)   */
/* ========================================= */

/* Syntax Box (Formula Breakdown) */
.syntax-box {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 1rem; margin-bottom: 1rem;
  font-size: 0.85rem;
}
.syntax-header { color: var(--accent); font-weight: bold; margin-bottom: 0.5rem; }
.arg-list { list-style: none; padding: 0; margin: 0; color: var(--text-dim); }
.arg-list li { margin-bottom: 0.3rem; }
.arg-list strong { color: #fff; }

/* Mistakes Grid */
.mistakes-container { margin-top: 1rem; display: grid; gap: 0.8rem; padding-bottom: 1rem; }
.mistake-card {
  background: rgba(239, 68, 68, 0.1); /* Red Tint */
  border-left: 4px solid #ef4444; padding: 0.8rem;
  border-radius: 0 0.5rem 0.5rem 0;
}
.mistake-title { color: #ef4444; font-weight: bold; font-size: 0.85rem; margin-bottom: 0.3rem; display: flex; align-items: center; gap: 0.4rem; }
.mistake-desc { color: var(--text-dim); font-size: 0.8rem; line-height: 1.4; }
.mistake-fix { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px dashed rgba(239, 68, 68, 0.3); color: var(--accent); font-size: 0.8rem; font-weight: bold; }

/* Result Box */
.result-box {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(34, 197, 94, 0.1); border: 1px solid var(--accent);
  padding: 1rem; border-radius: 0.5rem; margin: 1.5rem 0;
}

/* Scrollable Panels */
.scroll-content { overflow-y: auto; flex: 1; padding-right: 5px; }
.scroll-content::-webkit-scrollbar { width: 4px; }
.scroll-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Animation Helpers */
.scan-col { background: rgba(34, 197, 94, 0.2); border: 2px dashed var(--accent); transition: 0.2s; }
.match-found { background: var(--accent); color: #000; font-weight: bold; }
.lookup-line { position: absolute; width: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); transform-origin: left center; transition: all 0.5s ease-in-out; z-index: 20; opacity: 0; }


/* 11. MOBILE RESPONSIVE */
@media(max-width: 800px) {
  .pageWrapper { grid-template-columns: 1fr; } 
  header { padding: 0.8rem; } 
  .brand-text { display: none; } 
  .card > div:first-child { flex-wrap: wrap !important; }
  h2 { max-width: 100%; white-space: normal; }
  .settings-row { width: 100%; justify-content: space-between; }
}

