/* Physics Tutor Pro – tutor.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.ctp-wrap {
  --ctp-p:   #1a6b3c;
  --ctp-dk:  #0d5c36;
  --ctp-a:   #8e44ad;
  --ctp-al:  #f3e5f5;
  --ctp-pl:  #e8f5e9;
  --ctp-pm:  #b8ddc8;
  --ctp-bg:  #f4fbf4;
  --ctp-bd:  #c8e6c9;
  --ctp-tx:  #1a2c1a;
  --ctp-mu:  #5a7a68;
  --ctp-wh:  #ffffff;
  --ctp-h:   750px;
  --ctp-yt:  #ff0000;
  font-family: 'Inter','Segoe UI',Arial,sans-serif;
  background:  var(--ctp-wh);
  border-radius: 18px;
  box-shadow: 0 10px 50px rgba(26,58,107,.15);
  border: 1.5px solid var(--ctp-bd);
  display: flex;
  flex-direction: column;
  max-width: 980px;
  margin: 0 auto;
  overflow: hidden;
}

/* ── Header ── */
.ctp-head {
  background: linear-gradient(135deg, #1a6b3c 0%, #0d5c36 100%);
  flex-shrink: 0;
}
.ctp-brand {
  display: flex; align-items: center; gap: 14px; padding: 18px 26px 12px;
}
.ctp-logo { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 8px rgba(0,0,0,.3)); }
.ctp-brand-name { font-size: 22px; font-weight: 800; color: #fff; line-height: 1.2; }
.ctp-brand-sub  { font-size: 12px; color: rgba(255,255,255,.70); margin-top: 3px; }
.ctp-tabs { display: flex; padding: 0 26px; border-top: 1px solid rgba(255,255,255,.12); }
.ctp-tab {
  background: none; border: none; border-bottom: 3px solid transparent;
  color: rgba(255,255,255,.60); padding: 12px 22px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .2s; display: flex; align-items: center; gap: 7px;
}
.ctp-tab:hover { color: #fff; }
.ctp-tab-on { color: #fff; border-bottom-color: #8e44ad; }

/* ── Panels ── */
.ctp-panel { display: none; flex: 1; overflow: hidden; min-height: var(--ctp-h); max-height: var(--ctp-h); }
.ctp-panel-on { display: flex; flex-direction: column; }
.ctp-hide { display: none; }

/* ── Curriculum ── */
.ctp-cur-wrap { display: flex; flex: 1; overflow: hidden; height: 100%; }
.ctp-sidebar {
  width: 195px; flex-shrink: 0;
  background: var(--ctp-bg); border-right: 1px solid var(--ctp-bd);
  overflow-y: scroll; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 14px 10px;
}
.ctp-sec-btn {
  width: 100%; background: none; border: none; text-align: left;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ctp-tx);
  padding: 9px 11px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: all .15s; margin-bottom: 3px; line-height: 1.4;
}
.ctp-sec-btn:hover { background: var(--ctp-pl); color: var(--ctp-p); }
.ctp-sec-on { background: var(--ctp-p) !important; color: #fff !important; }
.ctp-content {
  flex: 1; overflow-y: scroll; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 20px 24px;
}
.ctp-sec { display: none; }
.ctp-sec-show { display: block; animation: ptpFade .2s ease; }
.ctp-sec-head {
  display: flex; align-items: center; gap: 11px;
  font-size: 20px; font-weight: 800; color: var(--ctp-p);
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--ctp-bd);
}

/* Topic item with YouTube videos */
.ctp-item {
  border: 1.5px solid var(--ctp-bd); border-radius: 13px;
  margin-bottom: 12px; background: var(--ctp-wh);
  transition: all .2s; overflow: hidden;
}
.ctp-item:hover { border-color: var(--ctp-p); box-shadow: 0 3px 16px rgba(26,58,107,.1); }
.ctp-item-top {
  display: flex; align-items: center; gap: 11px; padding: 13px 16px 10px;
}
.ctp-dot { width: 8px; height: 8px; background: var(--ctp-a); border-radius: 50%; flex-shrink: 0; }
.ctp-item-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--ctp-tx); line-height: 1.5; }
.ctp-explain-btn {
  background: var(--ctp-pl); color: var(--ctp-p);
  border: 1.5px solid var(--ctp-pm); padding: 6px 13px; border-radius: 8px;
  font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; transition: all .2s;
}
.ctp-explain-btn:hover { background: var(--ctp-p); color: #fff; }

/* YouTube video buttons */
.ctp-videos {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 0 16px 13px;
}
.ctp-vid-btn {
  display: flex; align-items: center; gap: 8px;
  background: #fff5f5; border: 1.5px solid #ffcdd2;
  border-radius: 8px; padding: 6px 12px;
  text-decoration: none; transition: all .2s; max-width: 280px;
}
.ctp-vid-btn:hover {
  background: var(--ctp-yt); border-color: var(--ctp-yt);
}
.ctp-vid-btn:hover .ctp-yt-icon,
.ctp-vid-btn:hover .ctp-vid-title,
.ctp-vid-btn:hover .ctp-vid-ch { color: #fff; }
.ctp-yt-icon {
  font-size: 14px; color: var(--ctp-yt); font-weight: 900;
  flex-shrink: 0; line-height: 1;
}
.ctp-vid-info { display: flex; flex-direction: column; }
.ctp-vid-title { font-size: 12px; font-weight: 600; color: var(--ctp-tx); line-height: 1.3; }
.ctp-vid-ch { font-size: 10px; color: var(--ctp-mu); margin-top: 1px; }

/* Explain box */
.ctp-explain-box {
  background: var(--ctp-wh); border: 2px solid var(--ctp-p);
  border-radius: 14px; margin-top: 20px; overflow: hidden;
  box-shadow: 0 6px 30px rgba(26,58,107,.15);
}
.ctp-explain-head {
  background: var(--ctp-pl); padding: 12px 18px; border-bottom: 1px solid var(--ctp-bd);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700; color: var(--ctp-p);
}
.ctp-explain-close {
  background: none; border: none; color: var(--ctp-mu); cursor: pointer;
  font-size: 13px; padding: 4px 9px; border-radius: 6px; font-family: inherit;
}
.ctp-explain-close:hover { background: var(--ctp-bd); }
.ctp-explain-body { padding: 20px 24px; font-size: 14px; line-height: 1.9; color: var(--ctp-tx); }

/* ── Practice ── */
.ctp-practice-wrap {
  padding: 22px 24px;
  overflow-y: scroll; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 16px; flex: 1;
}
.ctp-practice-title { font-size: 16px; font-weight: 700; color: var(--ctp-p); margin: 0 0 10px; }
.ctp-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ctp-pill {
  background: var(--ctp-bg); border: 1.5px solid var(--ctp-bd); border-radius: 20px;
  padding: 7px 16px; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ctp-mu); cursor: pointer; transition: all .15s;
}
.ctp-pill:hover { border-color: var(--ctp-p); color: var(--ctp-p); }
.ctp-pill-on { background: var(--ctp-p); border-color: var(--ctp-p); color: #fff; }
.ctp-pill-gold { border-color: #d4980a; color: #7a5500; }
.ctp-pill-gold.ctp-pill-on { background: var(--ctp-a); border-color: var(--ctp-a); color: #fff; }
.ctp-pill-blue { border-color: #4a6cf7; color: #2a3db0; }
.ctp-pill-blue.ctp-pill-on { background: #4a6cf7; border-color: #4a6cf7; color: #fff; }

.ctp-mcq-settings { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.ctp-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 140px; }
.ctp-field label { font-size: 12px; font-weight: 700; color: var(--ctp-mu); }
.ctp-mcq-topic,.ctp-mcq-count,.ctp-mcq-diff,.ctp-fc-topic {
  border: 1.5px solid var(--ctp-bd); border-radius: 9px; padding: 8px 11px;
  font-family: inherit; font-size: 13px; color: var(--ctp-tx); background: var(--ctp-wh); cursor: pointer;
}
.ctp-mcq-topic:focus,.ctp-mcq-count:focus,.ctp-mcq-diff:focus,.ctp-fc-topic:focus {
  outline: none; border-color: var(--ctp-p);
}
.ctp-btn-primary {
  background: var(--ctp-p); color: #fff; border: none;
  padding: 10px 24px; border-radius: 9px; font-family: inherit;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s;
  box-shadow: 0 4px 16px rgba(26,58,107,.3);
}
.ctp-btn-primary:hover { background: var(--ctp-dk); transform: translateY(-1px); }
.ctp-btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.ctp-mcq-progress,.ctp-fc-progress {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: var(--ctp-mu); font-weight: 600; padding: 8px 0;
}

/* MCQ Cards */
.ctp-mcq-card {
  background: var(--ctp-wh); border: 2px solid var(--ctp-bd);
  border-radius: 13px; padding: 20px; margin-top: 12px;
  box-shadow: 0 2px 12px rgba(26,58,107,.07);
}
.ctp-mcq-q { font-size: 15px; font-weight: 700; color: var(--ctp-tx); margin-bottom: 14px; line-height: 1.6; }
.ctp-mcq-opts { display: flex; flex-direction: column; gap: 8px; }
.ctp-mcq-opt {
  width: 100%; text-align: left; background: var(--ctp-bg);
  border: 1.5px solid var(--ctp-bd); border-radius: 10px; padding: 11px 16px;
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--ctp-tx);
  cursor: pointer; transition: all .15s; line-height: 1.5;
}
.ctp-mcq-opt:hover:not(:disabled) { background: var(--ctp-pl); border-color: var(--ctp-p); color: var(--ctp-p); }
.ctp-mcq-opt:disabled { cursor: default; }
.ctp-opt-right { background: #d4f4e0 !important; border-color: #27ae60 !important; color: #145a32 !important; font-weight: 700 !important; }
.ctp-opt-wrong { background: #fde8e8 !important; border-color: #e74c3c !important; color: #8c1d1d !important; }
.ctp-mcq-fb { margin-top: 10px; padding: 10px 14px; border-radius: 9px; font-size: 14px; font-weight: 700; }
.ctp-fb-ok { background: #d4f4e0; color: #145a32; }
.ctp-fb-no { background: #fde8e8; color: #8c1d1d; }
.ctp-mcq-exp { margin-top: 10px; padding: 12px 16px; background: #fff8ec; border-left: 4px solid var(--ctp-a); border-radius: 0 10px 10px 0; font-size: 13px; line-height: 1.8; }

/* Flashcards */
.ctp-fc-zone { display: grid; grid-template-columns: repeat(auto-fill,minmax(215px,1fr)); gap: 14px; margin-top: 12px; }
.ctp-fc { height: 170px; perspective: 900px; cursor: pointer; }
.ctp-fc-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.ctp-fc-flipped .ctp-fc-in { transform: rotateY(180deg); }
.ctp-fc-face { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; gap: 8px; }
.ctp-fc-front { background: linear-gradient(135deg, #1a6b3c, #0d5c36); color: #fff; }
.ctp-fc-back  { background: #fff8ec; border: 2px solid var(--ctp-a); color: var(--ctp-tx); transform: rotateY(180deg); }
.ctp-fc-text  { font-size: 14px; font-weight: 700; line-height: 1.5; }
.ctp-fc-hint  { font-size: 11px; opacity: .7; }

/* ── Chat ── */
.ctp-chat-wrap { display: flex; flex-direction: column; flex: 1; height: 100%; overflow: hidden; }
.ctp-msgs {
  flex: 1; overflow-y: scroll; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 16px;
}
.ctp-msg { display: flex; gap: 10px; align-items: flex-start; }
.ctp-bot { flex-direction: row; }
.ctp-user { flex-direction: row-reverse; }
.ctp-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; background: var(--ctp-pl); box-shadow: 0 2px 8px rgba(26,58,107,.15); }
.ctp-user .ctp-avatar { background: var(--ctp-al); }
.ctp-msg-inner { display: flex; flex-direction: column; max-width: 78%; }
.ctp-bot .ctp-msg-inner { align-items: flex-start; }
.ctp-user .ctp-msg-inner { align-items: flex-end; }
.ctp-bubble { padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.8; color: var(--ctp-tx); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.ctp-bot .ctp-bubble { background: var(--ctp-bg); border: 1px solid var(--ctp-bd); border-top-left-radius: 4px; }
.ctp-user .ctp-bubble { background: var(--ctp-p); color: #fff; border-top-right-radius: 4px; }
.ctp-bubble p { margin: 0 0 7px; } .ctp-bubble p:last-child { margin-bottom: 0; }
.ctp-bubble ul { margin: 7px 0; padding-left: 20px; } .ctp-bubble li { margin-bottom: 4px; }
.ctp-dots { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.ctp-dots span { width: 7px; height: 7px; background: var(--ctp-p); border-radius: 50%; animation: ptpBounce .9s infinite; }
.ctp-dots span:nth-child(2) { animation-delay: .15s; }
.ctp-dots span:nth-child(3) { animation-delay: .30s; }
.ctp-suggests { padding: 9px 16px 8px; display: flex; flex-wrap: wrap; gap: 7px; border-top: 1px solid var(--ctp-bd); background: var(--ctp-bg); flex-shrink: 0; }
.ctp-sug { background: var(--ctp-wh); border: 1.5px solid var(--ctp-bd); border-radius: 20px; padding: 5px 13px; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--ctp-tx); cursor: pointer; transition: all .15s; }
.ctp-sug:hover { background: var(--ctp-p); border-color: var(--ctp-p); color: #fff; }
.ctp-input-row { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--ctp-bd); background: var(--ctp-wh); flex-shrink: 0; }
.ctp-mic { width: 42px; height: 42px; background: var(--ctp-bg); border: 1.5px solid var(--ctp-bd); border-radius: 12px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s; }
.ctp-mic:hover { background: var(--ctp-pl); border-color: var(--ctp-p); }
.ctp-mic-on { background: #ff4444 !important; border-color: #cc0000 !important; color: #fff; font-size: 12px !important; width: 58px !important; }
.ctp-input { flex: 1; border: 1.5px solid var(--ctp-bd); border-radius: 12px; padding: 10px 14px; font-family: inherit; font-size: 14px; resize: none; color: var(--ctp-tx); background: var(--ctp-wh); max-height: 120px; transition: border-color .2s, box-shadow .2s; }
.ctp-input:focus { outline: none; border-color: var(--ctp-p); box-shadow: 0 0 0 3px rgba(26,58,107,.12); }
.ctp-send { width: 42px; height: 42px; background: var(--ctp-p); border: none; border-radius: 12px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s; box-shadow: 0 3px 14px rgba(26,58,107,.35); }
.ctp-send:hover { background: var(--ctp-dk); transform: scale(1.06); }
.ctp-send svg { width: 18px; height: 18px; }
.ctp-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* TTS */
.ctp-tts-bar { display: flex; padding: 6px 2px 2px; }
.ctp-explain-body .ctp-tts-bar { padding: 10px 20px 14px; border-top: 1px solid var(--ctp-bd); margin-top: 6px; }
.ctp-tts-btn { background: transparent; border: 1.5px solid var(--ctp-bd); border-radius: 20px; padding: 5px 16px; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ctp-p); cursor: pointer; transition: all .2s; }
.ctp-tts-btn:hover { background: var(--ctp-p); border-color: var(--ctp-p); color: #fff; }
.ctp-tts-btn.ctp-tts-on { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }

/* Spinner & Loading */
.ctp-spin { width: 22px; height: 22px; border: 3px solid var(--ctp-bd); border-top-color: var(--ctp-p); border-radius: 50%; animation: ptpSpin .7s linear infinite; flex-shrink: 0; }
.ctp-explain-loading { display: flex; align-items: center; gap: 12px; padding: 20px; font-size: 14px; color: var(--ctp-mu); font-weight: 600; }

/* AI content */
.ctp-ai h1,.ctp-ai h2,.ctp-ai h3 { color: var(--ctp-p); margin: 16px 0 8px; }
.ctp-ai h3 { font-size: 15px; }
.ctp-ai p { margin: 0 0 10px; }
.ctp-ai ul,.ctp-ai ol { padding-left: 22px; margin: 8px 0; }
.ctp-ai li { margin-bottom: 6px; line-height: 1.7; }
.ctp-ai strong { color: var(--ctp-p); }
.ctp-ai em { font-style: italic; }
.ctp-ai code { background: var(--ctp-pl); color: var(--ctp-p); padding: 2px 7px; border-radius: 5px; font-size: .9em; font-family: 'Courier New',monospace; }
.ctp-ai blockquote { border-left: 4px solid var(--ctp-a); padding: 8px 16px; margin: 10px 0; background: var(--ctp-al); border-radius: 0 8px 8px 0; }

.ctp-err { color: #c00; }

/* Scrollbars */
.ctp-msgs::-webkit-scrollbar,.ctp-content::-webkit-scrollbar,.ctp-sidebar::-webkit-scrollbar,.ctp-practice-wrap::-webkit-scrollbar { width: 5px; }
.ctp-msgs::-webkit-scrollbar-track,.ctp-content::-webkit-scrollbar-track { background: transparent; }
.ctp-msgs::-webkit-scrollbar-thumb,.ctp-content::-webkit-scrollbar-thumb { background: var(--ctp-bd); border-radius: 3px; }

/* Animations */
@keyframes ptpFade   { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
@keyframes ptpSpin   { to{transform:rotate(360deg)} }
@keyframes ptpBounce { 0%,80%,100%{transform:scale(0)} 40%{transform:scale(1)} }

/* Responsive */
@media(max-width:680px){
  .ctp-sidebar{width:150px;} .ctp-brand-name{font-size:18px;}
  .ctp-tab{padding:10px 12px;font-size:13px;}
  .ctp-panel{min-height:520px;max-height:520px;}
  .ctp-fc-zone{grid-template-columns:1fr 1fr;}
  .ctp-vid-btn{max-width:100%;}
}
@media(max-width:500px){
  .ctp-cur-wrap{flex-direction:column;}
  .ctp-sidebar{width:100%;height:auto;border-right:none;border-bottom:1px solid var(--ctp-bd);display:flex;flex-wrap:wrap;gap:5px;padding:8px;overflow-y:visible;}
  .ctp-sec-btn{width:auto;font-size:12px;padding:6px 10px;}
  .ctp-fc-zone{grid-template-columns:1fr;}
}

/* Chemistry accent overrides */
.ctp-wrap { --ctp-a: #8e44ad; --ctp-al: #f3e5f5; }
.ctp-fc-back { background: #f3e5f5; border-color: #8e44ad; }
.ctp-mcq-exp { background: #f3e5f5; border-left-color: #8e44ad; }
.ctp-pill-gold.ctp-pill-on { background: #8e44ad; border-color: #8e44ad; }
.ctp-qbtn:hover { background: #f3e5f5; border-color: #8e44ad; color: #6c3483; }
