
:root {
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --sidebar: #171b2e;
  --sidebar-muted: #a2a9c1;
  --background: #f6f7fb;
  --surface: #ffffff;
  --text: #20243a;
  --muted: #777e93;
  --border: #e7e9f1;
  --radius: 16px;
}

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

body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-layout {
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--sidebar);
  color: white;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  font-size: 23px;
  font-weight: 750;
  color: white;
  text-decoration: none;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary);
  font-size: 27px;
}

.brand-accent {
  color: #a5b4fc;
}

.menu-label,
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 750;
}

.menu-label {
  color: var(--sidebar-muted);
  padding: 0 12px;
  margin-bottom: -20px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 14px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  transition: background 0.2s, color 0.2s;
}

.nav-item > span {
  width: 23px;
  text-align: center;
  font-size: 20px;
}

.nav-item:hover,
.nav-item.active {
  background: #303651;
  color: white;
}

.nav-item.active {
  box-shadow: inset 3px 0 #818cf8;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 20px;
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 10px 0;
  border-top: 1px solid #34384d;
}

.note-dot,
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
}

.sidebar-note strong,
.sidebar-note small {
  display: block;
}

.sidebar-note strong {
  font-size: 12px;
}

.sidebar-note small {
  color: var(--sidebar-muted);
  font-size: 11px;
  margin-top: 3px;
}

/* Main content */
.main-content {
  margin-left: 250px;
  min-height: 100vh;
  padding: 32px 38px 20px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 34px;
}

.eyebrow {
  color: var(--primary);
  margin-bottom: 5px;
}

h1 {
  font-size: 29px;
  letter-spacing: -0.8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

/* Dashboard */
.welcome-panel {
  padding: 28px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #3730a3, #6366f1);
  color: white;
  margin-bottom: 30px;
  overflow: hidden;
}

.welcome-panel h2 {
  font-size: 25px;
  margin-bottom: 8px;
}

.welcome-panel p {
  color: #e0e7ff;
  max-width: 540px;
}

.welcome-label {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 10px;
  border: 1px solid #a5b4fc;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 19px;
}

.section-heading p {
  color: var(--muted);
  font-size: 13px;
}

.search-input {
  width: 230px;
  max-width: 100%;
  padding: 10px 13px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}

.search-input:focus,
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.calculator-card {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
}

.calculator-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px #20243a12;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  border-radius: 13px;
  font-size: 25px;
  margin-bottom: 19px;
}

.card-icon.purple {
  background: #eeebff;
  color: #6d5ce8;
}

.card-icon.green {
  background: #e1f8ed;
  color: #15875b;
}

.card-icon.pink {
  background: #ffe8f0;
  color: #d63384;
}

.card-icon.blue {
  background: #e5f1ff;
  color: #2878d0;
}

.calculator-card h3 {
  font-size: 16px;
  margin-bottom: 7px;
}

.calculator-card p {
  font-size: 13px;
  color: var(--muted);
  min-height: 40px;
}

.card-action {
  display: inline-block;
  margin-top: 17px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.empty-state {
  color: var(--muted);
  padding: 25px 0;
}

/* Placeholder module pages */
.module-panel {
  max-width: 700px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.module-panel h2 {
  margin-bottom: 8px;
}

.module-panel p {
  color: var(--muted);
  margin-bottom: 18px;
}

.module-tag {
  display: inline-block;
  padding: 5px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 15px;
}

.footer {
  margin-top: auto;
  padding-top: 40px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.footer span {
  padding: 0 5px;
}

/* Responsive layout */
@media (max-width: 1100px) {
  .calculator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-content {
    padding: 28px 24px;
  }
}

@media (max-width: 700px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 17px;
    gap: 18px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-label {
    margin-bottom: -8px;
  }

  .sidebar-bottom {
    margin-top: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-right {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }
}



/* Basic Calculator Module */
.calculator-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  align-items: start;
  gap: 30px;
}

.calculator-intro {
  padding: 10px 0;
}

.calculator-intro h2 {
  font-size: 25px;
  margin-bottom: 8px;
}

.calculator-intro p {
  color: var(--muted);
  max-width: 340px;
}

.calculator-shell {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  border-radius: 22px;
  background: #171b2e;
  box-shadow: 0 18px 45px #171b2e20;
}

.calculator-screen {
  min-height: 112px;
  padding: 16px 12px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  overflow: hidden;
  background: #222840;
  border-radius: 13px;
}

.calculator-status {
  min-height: 20px;
  color: #fca5a5;
  font-size: 12px;
  text-align: right;
}

.calculator-display {
  max-width: 100%;
  color: #ffffff;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 650;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
}

.calculator-keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.calc-key {
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-radius: 12px;
  background: #292f48;
  color: #ffffff;
  font-size: 19px;
  font-weight: 600;
  transition: background 0.15s, transform 0.15s;
}

.calc-key:hover {
  background: #3a4261;
}

.calc-key:active {
  transform: scale(0.96);
}

.calc-key:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 2px;
}

.calc-key.utility {
  background: #373e59;
  color: #c7d2fe;
}

.calc-key.operator {
  background: #4f46e5;
}

.calc-key.operator:hover,
.calc-key.equals:hover {
  background: #6366f1;
}

.calc-key.equals {
  background: #818cf8;
  color: #171b2e;
}

.calculator-hint {
  margin-top: 16px;
  color: #a2a9c1;
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
}

@media (max-width: 950px) {
  .calculator-workspace {
    grid-template-columns: 1fr;
  }

  .calculator-shell {
    max-width: 400px;
  }
}

@media (max-width: 420px) {
  .calculator-shell {
    padding: 12px;
  }

  .calculator-keypad {
    gap: 7px;
  }

  .calc-key {
    min-height: 52px;
  }
}



/* Simple Interest Calculator Module */
.interest-workspace {
  display: grid;
  gap: 25px;
}

.interest-intro h2 {
  font-size: 25px;
  margin: 12px 0 8px;
}

.interest-intro p {
  color: var(--muted);
  max-width: 620px;
}

.interest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.interest-form,
.interest-results {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 25px;
}

.interest-form h3,
.results-heading h3 {
  font-size: 17px;
  margin-bottom: 20px;
}

.form-field {
  display: grid;
  gap: 8px;
  margin-bottom: 19px;
}

.form-field label {
  font-size: 13px;
  font-weight: 650;
}

.form-input {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  color: var(--text);
  outline: none;
}

.time-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 115px;
  gap: 9px;
}

.interest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 23px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 9px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: white;
}

.primary-button:hover {
  background: #4338ca;
}

.secondary-button {
  background: var(--primary-light);
  color: var(--primary);
}

.form-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 14px;
}

.results-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.results-heading h3 {
  margin-bottom: 3px;
}

.results-heading p {
  color: var(--muted);
  font-size: 12px;
}

.result-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #e1f8ed;
  color: #15875b;
  font-size: 23px;
  font-weight: 700;
}

.result-highlight {
  background: #e1f8ed;
  border-radius: 13px;
  padding: 20px;
  margin-bottom: 16px;
}

.result-highlight p {
  color: #166b4b;
  font-size: 13px;
  margin-bottom: 6px;
}

.result-highlight h2 {
  color: #126747;
  font-size: clamp(22px, 3vw, 30px);
  overflow-wrap: anywhere;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.result-row span {
  color: var(--muted);
}

.result-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.result-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

@media (max-width: 950px) {
  .interest-layout {
    grid-template-columns: 1fr;
  }
}



/* BMI Calculator Module */
.bmi-workspace {
  display: grid;
  gap: 25px;
}

.bmi-intro h2 {
  font-size: 25px;
  margin: 12px 0 8px;
}

.bmi-intro p {
  max-width: 650px;
  color: var(--muted);
}

.bmi-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 22px;
}

.bmi-form,
.bmi-results {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 25px;
}

.bmi-form h3 {
  font-size: 17px;
  margin-bottom: 22px;
}

.bmi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.bmi-result-icon {
  background: #ffe8f0;
  color: #d63384;
}

.bmi-score-panel {
  padding: 24px 18px;
  border-radius: 14px;
  background: #fff0f6;
  text-align: center;
}

.bmi-score-panel > p {
  color: #8d4166;
  font-size: 13px;
}

.bmi-score-panel h2 {
  color: #9d174d;
  font-size: 42px;
  margin: 6px 0 12px;
}

.bmi-category {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 20px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.category-underweight {
  background: #dbeafe;
  color: #1d4ed8;
}

.category-healthy {
  background: #dcfce7;
  color: #166534;
}

.category-overweight {
  background: #fef3c7;
  color: #92400e;
}

.category-obesity {
  background: #fee2e2;
  color: #991b1b;
}

.bmi-scale {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr 1fr;
  gap: 4px;
  margin-top: 25px;
}

.bmi-scale-segment {
  height: 9px;
  border-radius: 5px;
}

.bmi-scale-segment.underweight {
  background: #60a5fa;
}

.bmi-scale-segment.healthy {
  background: #4ade80;
}

.bmi-scale-segment.overweight {
  background: #fbbf24;
}

.bmi-scale-segment.obesity {
  background: #f87171;
}

.bmi-scale-labels {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.bmi-explanation {
  margin-top: 24px;
  padding: 14px;
  background: var(--background);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 950px) {
  .bmi-layout {
    grid-template-columns: 1fr;
  }
}



/* Module 5: Calculation History */

.history-workspace {
  display: grid;
  gap: 24px;
}

.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.history-heading h2 {
  font-size: 25px;
  margin: 12px 0 8px;
}

.history-heading p {
  color: var(--muted);
}

.history-empty {
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-empty h3 {
  margin-bottom: 10px;
}

.history-empty p {
  color: var(--muted);
  line-height: 1.7;
}

.history-table-wrapper {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th,
.history-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.history-table th {
  font-size: 12px;
  color: var(--muted);
  background: var(--background);
}

.history-table td {
  font-size: 13px;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 600px) {
  .history-heading {
    align-items: flex-start;
  }

  .history-table th,
  .history-table td {
    padding: 12px;
  }
}

