@import url("./core/theme-light.css");

/* Màu nhận diện Hóa học (Teal) */
:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-soft: #f0fdfa;
  --primary-border: #99f6e4;
}

/* Tabs */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Periodic Table Wrapper (18 columns, mobile horizontal scroll without page overflow) */
.pt-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.pt-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(50px, 1fr));
  gap: 4px;
  min-width: 940px;
}

.pt-cell {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 4px;
  background: var(--bg-surface);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 58px;
  user-select: none;
}

.pt-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  z-index: 2;
}

.pt-cell.selected {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  z-index: 3;
}

.pt-cell.dimmed {
  opacity: 0.28;
}

.pt-num {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}

.pt-sym {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 2px 0 1px;
}

.pt-name {
  font-size: 0.6rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.pt-mass {
  font-size: 0.58rem;
  color: var(--text-muted);
  line-height: 1;
}

/* Category colors (light neutral tints) */
.cat-alkali { background: #fef2f2; border-color: #fecaca; }
.cat-alkaline { background: #fff7ed; border-color: #fed7aa; }
.cat-transition { background: #eff6ff; border-color: #bfdbfe; }
.cat-post { background: #f0fdf4; border-color: #bbf7d0; }
.cat-metalloid { background: #f0fdfa; border-color: #99f6e4; }
.cat-nonmetal { background: #fefce8; border-color: #fef08a; }
.cat-halogen { background: #fdf4ff; border-color: #f5d0fe; }
.cat-noble { background: #f5f3ff; border-color: #ddd6fe; }
.cat-lanthanide { background: #ecfeff; border-color: #a5f3fc; }
.cat-actinide { background: #fdf2f8; border-color: #fbcfe8; }
.cat-other { background: #f8fafc; border-color: #e2e8f0; }

.pt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pt-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
}

.pt-legend-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.pt-legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

/* Element Inspector */
.element-inspector {
  margin-top: 18px;
  border: 1px solid var(--primary-border);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.el-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.el-badge-box {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary-border);
  background: var(--primary-soft);
  flex-shrink: 0;
}

.el-badge-num { font-size: 0.75rem; font-weight: 700; color: var(--primary); line-height: 1; }
.el-badge-sym { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }

.el-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.el-prop {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.el-prop-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.el-prop-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

/* Chips & Equation Balancer */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}

.chip-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.eq-result-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
}

.eq-formatted {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

.eq-coef {
  color: var(--primary);
  font-weight: 800;
}

/* Solubility Table */
.sol-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.sol-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 680px;
}

.sol-table th, .sol-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
}

.sol-table th {
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-weight: 700;
}

.sol-T { background: #f0fdf4; color: #166534; font-weight: 700; }
.sol-K { background: #fef2f2; color: #991b1b; font-weight: 700; }
.sol-I { background: #fffbeb; color: #92400e; font-weight: 700; }
.sol-P { background: #f1f5f9; color: #475569; font-weight: 600; }

/* Activity Series */
.activity-series {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 12px 0;
}

.act-item {
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
}

.act-item.before-h {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.act-item.is-h {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

/* Two-column utility layout */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.reaction-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.reaction-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.reaction-item-eq {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.reaction-item-meta {
  font-size: 0.83rem;
  color: var(--text-secondary);
}
