/* ==========================================================================
   DR. HEBA OSAMA CHEMISTRY PLATFORM — ADVANCED CHEMISTRY SUITE & TOOLS CSS
   100% GPU-Accelerated, Mobile-Responsive & Low-Power Friendly
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FLOATING EXAM & STUDY TOOLBAR BUTTONS
   
   -------------------------------------------------------------------------- */
.chem-suite-toolbar-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-chem-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0b253a;
}

.btn-chem-tool:hover {
  background: #e0f2fe;
  border-color: #00b4d8;
  color: #0369a1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.15);
}

.btn-chem-tool i {
  color: #00b4d8;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   2. INTERACTIVE PERIODIC TABLE & DATA BOOKLET MODAL
   -------------------------------------------------------------------------- */
.ptable-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 37, 58, 0.72);
  backdrop-filter: blur(4px);
  z-index: 99980;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ptable-modal-overlay.active {
  display: flex;
}

.ptable-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 1240px;
  max-height: 92vh;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(11, 37, 58, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid #cbd5e1;
}

.ptable-header {
  background: linear-gradient(135deg, #0b253a 0%, #133b5c 100%);
  color: #ffffff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ptable-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 10px;
  flex-wrap: wrap;
}

.ptable-tab-btn {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ptable-tab-btn.active,
.ptable-tab-btn:hover {
  background: #00b4d8;
  color: #ffffff;
}

/* Molar Mass Calculator Bar inside Periodic Table */
.molar-mass-bar {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.molar-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 260px;
}

.molar-formula-input {
  padding: 7px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0b253a;
  width: 210px;
}

.molar-formula-input:focus {
  border-color: #00b4d8;
  outline: none;
}

.molar-result-pill {
  background: #ecfdf5;
  border: 1.5px solid #6ee7b7;
  color: #065f46;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 18-Column Periodic Table Grid */
.ptable-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  background: #ffffff;
}

.ptable-scroll-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}

.ptable-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(52px, 1fr));
  gap: 4px;
  min-width: 960px;
}

.pt-cell {
  border-radius: 6px;
  padding: 4px 3px;
  text-align: center;
  cursor: pointer;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 56px;
  position: relative;
  user-select: none;
}

.pt-cell:hover {
  transform: scale(1.14);
  z-index: 5;
  box-shadow: 0 6px 16px rgba(11, 37, 58, 0.22);
}

.pt-num {
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.8;
  line-height: 1;
  text-align: left;
  padding-left: 2px;
}

.pt-sym {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.1;
}

.pt-name {
  font-size: 0.52rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

.pt-mass {
  font-size: 0.58rem;
  font-weight: 700;
  opacity: 0.85;
}

/* Element Category Colors */
.pt-cat-alkali {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.pt-cat-alkaline {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

.pt-cat-transition {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}

.pt-cat-post-transition {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.pt-cat-metalloid {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
}

.pt-cat-nonmetal {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

.pt-cat-halogen {
  background: #fae8ff;
  color: #86198f;
  border-color: #f0abfc;
}

.pt-cat-noble {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

.pt-cat-lanthanide {
  background: #fce7f3;
  color: #9d174d;
  border-color: #f9a8d4;
}

.pt-cat-actinide {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

/* Element Detail Inspector Card */
.pt-inspector-banner {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   3. FLOATING DRAGGABLE SCIENTIFIC CALCULATOR WIDGET
   -------------------------------------------------------------------------- */
.chem-calc-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.55);
  border: 1.5px solid #334155;
  z-index: 99985;
  display: none;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

.chem-calc-floating.active {
  display: flex;
}

.chem-calc-header {
  background: #1e293b;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  border-bottom: 1px solid #334155;
}

.chem-calc-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chem-calc-screen {
  background: #020617;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid #1e293b;
}

.chem-calc-expr {
  font-family: monospace;
  font-size: 0.78rem;
  color: #94a3b8;
  min-height: 18px;
  word-break: break-all;
}

.chem-calc-val {
  font-family: monospace;
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 4px;
  overflow-x: auto;
}

.chem-calc-constants {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px 10px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.calc-const-btn {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.calc-const-btn:hover {
  background: #0284c7;
  color: #ffffff;
}

.chem-calc-keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px;
}

.calc-key {
  border: none;
  border-radius: 8px;
  padding: 10px 4px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  background: #1e293b;
  color: #f8fafc;
  transition: background 0.12s ease, transform 0.08s ease;
}

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

.calc-key.fn {
  background: #334155;
  color: #bae6fd;
  font-size: 0.76rem;
}

.calc-key.op {
  background: #0284c7;
  color: #ffffff;
}

.calc-key.eq {
  background: #10b981;
  color: #ffffff;
  grid-column: span 2;
}

.calc-key.clr {
  background: #ef4444;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   4. STUDENT REVISION HUB: 3D FLASHCARDS & MISTAKE NOTEBOOK
   -------------------------------------------------------------------------- */
.chem-flashcard-scene {
  width: 100%;
  max-width: 620px;
  height: 290px;
  margin: 0 auto 18px auto;
  perspective: 1100px;
  cursor: pointer;
}

.chem-flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

.chem-flashcard-inner.is-flipped {
  transform: rotateY(180deg);
}

.chem-flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 18px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 12px 32px rgba(11, 37, 58, 0.1);
}

.chem-flashcard-front {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #bae6fd;
  color: #0b253a;
}

.chem-flashcard-back {
  background: linear-gradient(135deg, #0b253a 0%, #1e3a5f 100%);
  border: 2px solid #00b4d8;
  color: #ffffff;
  transform: rotateY(180deg);
}

.mistake-card {
  background: #ffffff;
  border: 1.5px solid #fecaca;
  border-left: 5px solid #ef4444;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(11, 37, 58, 0.04);
}

/* --------------------------------------------------------------------------
   5. QUESTION-LEVEL CLASS MASTERY HEATMAP
   -------------------------------------------------------------------------- */
.quiz-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.heatmap-tile {
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
  border: 1.5px solid transparent;
}

.heatmap-tile.high {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.heatmap-tile.med {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.heatmap-tile.low {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* --------------------------------------------------------------------------
   6. RED-PEN HOMEWORK ANNOTATION STUDIO
   -------------------------------------------------------------------------- */
.annotation-studio-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  z-index: 99990;
  display: none;
  flex-direction: column;
}

.annotation-studio-overlay.active {
  display: flex;
}

.annotation-toolbar {
  background: #1e293b;
  color: #ffffff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #334155;
}

.annotation-canvas-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
}

.annotation-canvas {
  background: #ffffff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}