/* ====== Vedic-Lab-like UI for AptiLearn ====== */
:root{
  --bg: #f6efe6;
  --panel: #f7d9b9;
  --card: #fff4e6;
  --card2:#fffaf3;
  --stroke: rgba(45, 24, 10, .12);
  --text: #2c1a10;
  --muted: rgba(44,26,16,.65);

  --accent: #ff7a21;
  --accent2:#ff9a4f;
  --danger: #ff5a3a;

  --shadow: 0 10px 28px rgba(0,0,0,.10);
  --radius: 18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% 0%, #fff3e4 0%, transparent 60%),
    radial-gradient(900px 600px at 90% 5%, #ffe3c8 0%, transparent 55%),
    var(--bg);
}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(246,239,230,.70);
  backdrop-filter: blur(8px);
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand__logo{ width:46px; height:46px; object-fit:contain; }
.brand__title{ font-weight:900; letter-spacing:.14em; font-size:12px; }
.brand__sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.topbar__right{ display:flex; gap:10px; align-items:center; }

/* Pills/Chips (prevent full-width!) */
.chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border: 1px solid var(--stroke);
  background: var(--card2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  cursor:pointer;
  white-space:nowrap;
}
.chip--ghost{
  background: transparent;
}

/* Layout */
.layout{
  display:grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 14px;
  padding: 14px;
  max-width: 1600px;
  margin: 0 auto;
}

/* Panels */
.panel{
  background: rgba(247,217,185,.55);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  min-height: 78vh;
}

/* Headings */
.h2{ margin: 8px 8px 10px; font-size:18px; font-weight:900; }
.h3{ font-size:15px; font-weight:900; }
.small{ font-size: 12px; }
.muted{ color: var(--muted); }

.label{
  display:block;
  font-weight:900;
  letter-spacing:.06em;
  font-size: 11px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* Cards */
.card{
  background: var(--card2);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 18px rgba(0,0,0,.06);
  margin: 10px 6px;
}
.card--soft{ background: rgba(255,244,230,.85); }

.questionBox{
  min-height: 56px;
  display:flex;
  align-items:center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 227, 197, .55);
  border: 1px solid rgba(45,24,10,.10);
  font-weight: 900;
}

/* Inputs */
.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(45,24,10,.14);
  background: #fff;
  font-size: 15px;
  outline:none;
}
.input:focus{
  border-color: rgba(255,122,33,.55);
  box-shadow: 0 0 0 3px rgba(255,122,33,.16);
}

/* Buttons */
.btn{
  width:100%;
  border:none;
  border-radius: 999px;
  padding: 12px 14px;
  font-weight: 900;
  cursor:pointer;
}
.btn--primary{
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color:#fff;
}
.btn--ghost{
  background: transparent;
  border: 1px solid rgba(45,24,10,.18);
}
.btn--danger{
  background: var(--danger);
  color:#fff;
}
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

.btn--half{ width:100%; }

.feedback{
  margin-top:10px;
  min-height:20px;
  font-weight: 900;
}

/* Center header */
.panelHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 6px 8px 10px;
}
.panelHeader__title{
  font-weight: 1000;
  letter-spacing:.02em;
}
.panelHeader__actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* Canvas */
.canvasWrap{
  background: rgba(255, 250, 243, .9);
  border: 1px solid rgba(45,24,10,.12);
  border-radius: 16px;
  padding: 10px;
  margin: 4px 6px;
  height: 520px;        /* desktop height like template */
}

/* Ask AI button row (matches new mock) */
.centerFooter{
  display:flex;
  justify-content:flex-end;
  padding: 6px 10px 0;
}
#pad{
  width:100%;
  height:100%;
  display:block;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid rgba(45,24,10,.10);
}

/* Formula card (bottom inside center) */
.formulaCard{
  margin: 12px 6px 6px;
  background: rgba(255,244,230,.92);
  border: 1px solid rgba(45,24,10,.12);
  border-radius: 16px;
  padding: 12px;
}
.formulaCard__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.tag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(45,24,10,.14);
  background: rgba(255,250,243,.9);
  font-size: 12px;
  font-weight: 900;
}
.formulaName{ font-weight: 1000; }
.formulaDesc{ margin-top:6px; color: var(--muted); font-size: 13px; }

/* Pills (LEVEL/TYPE) */
.pills{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.pills--small .pill{ padding: 10px 12px; }
.pill{
  border: 1px solid rgba(45,24,10,.14);
  background: rgba(255,250,243,.95);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 1000;
  cursor:pointer;
  min-width: 74px;
  text-align:center;
}
.pill.is-active{
  background: rgba(255,122,33,.18);
  border-color: rgba(255,122,33,.45);
}

/* Meta blocks */
.block{ margin-top: 12px; }
.note{
  background: rgba(255,122,33,.12);
  border: 1px dashed rgba(255,122,33,.45);
  padding: 10px;
  border-radius: 14px;
  color: #6b3a1c;
  font-size: 12px;
}
.row{ display:flex; align-items:center; }
.row--space{ justify-content:space-between; gap: 10px; margin-top: 12px; }
.row--gap{ gap: 10px; margin-top: 12px; }
.meta{ flex:1; }
.meta--right{ text-align:right; }
.big{ font-size: 18px; font-weight: 1000; }

/* Progress */
.progress{
  height: 10px;
  background: rgba(45,24,10,.08);
  border-radius: 999px;
  overflow:hidden;
  margin-top: 8px;
}
.progress__bar{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* Table */
.tableWrap{
  margin-top: 10px;
  border: 1px solid rgba(45,24,10,.12);
  border-radius: 14px;
  overflow:auto;
  max-height: 230px;
  background: #fff;
}
.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  font-size: 12px;
}
.table th{
  position: sticky;
  top: 0;
  background: #fff6ea;
  text-align:left;
  z-index: 1;
}

/* ===== AUTO STACK on mobile ===== */
@media (max-width: 900px){
  .layout{
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .panel{ min-height: auto; }
  .canvasWrap{ height: 320px; }   /* smaller on mobile */
  .table{ min-width: 100%; }
  .topbar{ flex-wrap: wrap; gap: 10px; justify-content:center; text-align:center; }
  .topbar__right{ width:100%; justify-content:center; }
}
