@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");

/* =========================================
   ROOT
========================================= */

:root {
  --primary: #18b7a0;
  --primary-dark: #0e9683;
  --secondary: #5b5bea;

  --blue: #4c8dff;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --yellow: #f5b942;
  --orange: #ff8a4c;

  --green-light: #e9fbf7;
  --blue-light: #eef5ff;
  --purple-light: #f3efff;
  --yellow-light: #fff8e7;
  --pink-light: #fff0f7;

  --text: #172033;
  --text-light: #687386;
  --border: #e6eaf0;

  --background: #f7f9fc;
  --white: #ffffff;

  --shadow-sm: 0 4px 15px rgba(24, 35, 56, 0.06);

  --shadow-md: 0 15px 40px rgba(24, 35, 56, 0.09);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* =========================================
   RESET
========================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
}

/* =========================================
   MAIN
========================================= */

.chem-lab {
  width: 100%;
  min-height: 100vh;
}

/* =========================================
   HEADER
========================================= */

.lab-header {
  position: relative;
  overflow: hidden;

  background: linear-gradient(135deg, #0fafa0 0%, #18b7a0 45%, #4b82ef 100%);

  color: white;
  padding: 25px 6%;
}

.header-content {
  max-width: 1400px;
  margin: auto;

  display: flex;
  justify-content: space-between;
  align-items: center;

  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-icon {
  width: 52px;
  height: 52px;

  display: grid;
  place-items: center;

  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;

  backdrop-filter: blur(10px);

  overflow: hidden;
}

.brand-icon a {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand h1 {
  font-family: "Space Grotesk", sans-serif;

  font-size: 22px;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;

  font-size: 12px;

  opacity: 0.82;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 10px 15px;

  border-radius: 50px;

  background: rgba(255, 255, 255, 0.15);

  border: 1px solid rgba(255, 255, 255, 0.22);

  font-size: 12px;
  font-weight: 600;

  backdrop-filter: blur(10px);
}

.status-dot {
  width: 8px;
  height: 8px;

  background: #b9ff75;

  border-radius: 50%;

  box-shadow: 0 0 0 4px rgba(185, 255, 117, 0.15);
}

.header-decoration {
  position: absolute;

  inset: 0;

  pointer-events: none;
}

.molecule {
  position: absolute;

  color: rgba(255, 255, 255, 0.13);

  font-size: 100px;
}

.molecule-1 {
  right: 10%;
  top: -20px;
}

.molecule-2 {
  right: 30%;
  bottom: -30px;
  font-size: 60px;
}

.molecule-3 {
  left: 45%;
  top: -30px;
  font-size: 75px;
}

/* =========================================
   INTRO
========================================= */

.intro-section {
  max-width: 1400px;

  margin: 0 auto;

  padding: 70px 6% 45px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 60px;
}

.intro-text {
  max-width: 750px;
}

.eyebrow {
  display: inline-flex;

  padding: 7px 12px;

  border-radius: 50px;

  background: var(--green-light);

  color: var(--primary-dark);

  font-size: 11px;
  font-weight: 800;

  letter-spacing: 0.8px;
}

.intro-text h2 {
  margin-top: 18px;

  font-family: "Space Grotesk", sans-serif;

  font-size: clamp(36px, 5vw, 64px);

  line-height: 1.05;

  letter-spacing: -2px;
}

.intro-text h2 span {
  color: var(--primary);
}

.intro-text p {
  max-width: 650px;

  margin-top: 20px;

  color: var(--text-light);

  font-size: 16px;

  line-height: 1.8;
}

/* =========================================
   FLASK
========================================= */

.lab-illustration {
  width: 260px;
  height: 230px;

  display: grid;
  place-items: center;

  position: relative;
}

.flask {
  position: relative;

  width: 145px;
  height: 190px;
}

.flask-neck {
  width: 46px;
  height: 65px;

  position: absolute;

  top: 0;
  left: 50%;

  transform: translateX(-50%);

  background: rgba(255, 255, 255, 0.7);

  border: 5px solid #7ddfd3;

  border-bottom: none;

  border-radius: 12px 12px 0 0;
}

.flask-body {
  position: absolute;

  left: 0;
  bottom: 0;

  width: 145px;
  height: 140px;

  overflow: hidden;

  background: rgba(255, 255, 255, 0.65);

  border: 5px solid #7ddfd3;

  border-radius: 25px 25px 60px 60px;

  box-shadow: 0 20px 50px rgba(24, 183, 160, 0.12);
}

.liquid {
  position: absolute;

  left: -10%;
  bottom: -5px;

  width: 120%;
  height: 85px;

  background: linear-gradient(180deg, #8eeadf, #29bca9);

  border-radius: 50% 50% 0 0;

  animation: liquidMove 3s ease-in-out infinite;
}

@keyframes liquidMove {
  0%,
  100% {
    transform: translateX(-4px);
  }

  50% {
    transform: translateX(4px);
  }
}

.bubble {
  position: absolute;

  width: 10px;
  height: 10px;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.65);

  animation: bubbleUp 3s infinite;
}

.bubble-1 {
  left: 40px;
  bottom: 40px;
}

.bubble-2 {
  left: 85px;
  bottom: 20px;
  animation-delay: 1s;
}

.bubble-3 {
  left: 60px;
  bottom: 60px;
  animation-delay: 1.7s;
}

@keyframes bubbleUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  30% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-60px);
  }
}

/* =========================================
   CALCULATOR SECTION
========================================= */

.calculator-section {
  max-width: 1400px;

  margin: 0 auto;

  padding: 20px 6% 80px;
}

.calculator-layout {
  display: grid;

  grid-template-columns: 290px 1fr;

  gap: 25px;

  align-items: start;
}

/* =========================================
   SIDEBAR
========================================= */

.calculator-sidebar {
  position: sticky;

  top: 20px;

  background: var(--white);

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  padding: 14px;

  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 10px 10px 18px;

  border-bottom: 1px solid var(--border);

  margin-bottom: 10px;
}

.sidebar-title > span {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  background: var(--green-light);

  border-radius: 11px;
}

.sidebar-title strong {
  display: block;

  font-size: 14px;
}

.sidebar-title small {
  display: block;

  margin-top: 3px;

  color: var(--text-light);

  font-size: 10px;
}

.calculator-tab {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 11px;

  border: none;

  background: transparent;

  padding: 11px 10px;

  margin-bottom: 3px;

  border-radius: 12px;

  color: var(--text);

  text-align: left;

  transition: 0.25s ease;
}

.calculator-tab:hover {
  background: #f6f8fb;
}

.calculator-tab.active {
  background: var(--green-light);

  color: var(--primary-dark);
}

.tab-icon {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  flex-shrink: 0;

  border-radius: 10px;

  background: #f7f8fa;

  font-size: 18px;
}

.calculator-tab.active .tab-icon {
  background: white;
}

.tab-content {
  min-width: 0;
}

.tab-content strong {
  display: block;

  font-size: 12px;

  line-height: 1.3;
}

.tab-content small {
  display: block;

  margin-top: 3px;

  color: var(--text-light);

  font-size: 9px;
}

.calculator-tab.active .tab-content small {
  color: var(--primary-dark);

  opacity: 0.75;
}

/* =========================================
   MAIN
========================================= */

.calculator-main {
  min-width: 0;
}

.calculator-card {
  display: none;

  background: var(--white);

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  padding: clamp(24px, 4vw, 40px);

  box-shadow: var(--shadow-sm);

  animation: cardIn 0.3s ease;
}

.calculator-card.active {
  display: block;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   CARD HEADER
========================================= */

.card-header {
  display: flex;

  justify-content: space-between;

  align-items: flex-start;

  gap: 30px;

  padding-bottom: 30px;

  border-bottom: 1px solid var(--border);

  margin-bottom: 30px;
}

.card-label {
  display: block;

  color: var(--primary);

  font-size: 10px;

  font-weight: 800;

  letter-spacing: 1px;

  margin-bottom: 8px;
}

.card-header h3 {
  font-family: "Space Grotesk", sans-serif;

  font-size: clamp(24px, 3vw, 32px);

  letter-spacing: -0.7px;
}

.card-header p {
  max-width: 650px;

  margin-top: 8px;

  color: var(--text-light);

  font-size: 13px;

  line-height: 1.7;
}

.formula {
  flex-shrink: 0;

  padding: 15px 20px;

  background: var(--purple-light);

  color: var(--purple);

  border-radius: 13px;

  font-family: "Space Grotesk", sans-serif;

  font-size: 18px;

  font-weight: 700;
}

/* =========================================
   INPUTS
========================================= */

.input-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 20px;
}

.input-grid.four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.input-group {
  display: flex;

  flex-direction: column;

  gap: 8px;
}

.input-group label,
.formula-input label {
  display: flex;

  align-items: center;

  justify-content: space-between;

  font-size: 12px;

  font-weight: 700;

  color: #313b4e;
}

.input-group label span {
  color: var(--primary);

  font-family: "Space Grotesk", sans-serif;

  font-size: 13px;
}

.input-group input,
.input-group select,
.formula-input input {
  width: 100%;

  height: 50px;

  border: 1px solid var(--border);

  border-radius: 11px;

  background: #fbfcfd;

  padding: 0 14px;

  outline: none;

  color: var(--text);

  font-size: 13px;

  transition: 0.2s ease;
}

.input-group input:focus,
.input-group select:focus,
.formula-input input:focus {
  border-color: var(--primary);

  background: white;

  box-shadow: 0 0 0 4px rgba(24, 183, 160, 0.1);
}

.input-group input::placeholder,
.formula-input input::placeholder {
  color: #a5adba;
}

.input-wrapper {
  display: flex;

  border: 1px solid var(--border);

  border-radius: 11px;

  background: #fbfcfd;

  overflow: hidden;

  transition: 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--primary);

  background: white;

  box-shadow: 0 0 0 4px rgba(24, 183, 160, 0.1);
}

.input-wrapper input {
  border: none;

  background: transparent;

  box-shadow: none;

  flex: 1;

  min-width: 0;
}

.input-wrapper input:focus {
  box-shadow: none;
}

.input-wrapper select {
  width: auto;

  min-width: 70px;

  border: none;

  border-left: 1px solid var(--border);

  border-radius: 0;

  background: white;
}

.unit-label {
  display: flex;

  align-items: center;

  padding: 0 15px;

  color: var(--text-light);

  font-size: 12px;

  background: white;

  border-left: 1px solid var(--border);
}

/* =========================================
   FORMULA INPUT
========================================= */

.formula-input {
  display: flex;

  flex-direction: column;

  gap: 9px;
}

.formula-input small {
  color: var(--text-light);

  font-size: 10px;
}

/* =========================================
   INFO
========================================= */

.info-note {
  margin-top: 20px;

  padding: 13px 15px;

  border-radius: 11px;

  background: var(--yellow-light);

  color: #85651a;

  border: 1px solid #f9e7a7;

  font-size: 11px;

  line-height: 1.6;
}

/* =========================================
   ACTIONS
========================================= */

.action-row {
  display: flex;

  gap: 10px;

  margin-top: 28px;
}

.calculate-btn {
  min-height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), #25cbb5);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(24, 183, 160, 0.2);
  transition: 0.2s ease;
}

.calculate-btn span {
  margin-left: 10px;
  font-size: 16px;
}

.calculate-btn:hover {
  transform: translateY(-2px);

  box-shadow: 0 12px 25px rgba(24, 183, 160, 0.27);
}

.reset-btn {
  min-height: 48px;

  padding: 0 18px;

  border: 1px solid var(--border);

  border-radius: 11px;

  background: white;

  color: var(--text-light);

  font-size: 12px;

  font-weight: 700;

  transition: 0.2s ease;
}

.reset-btn:hover {
  border-color: #ccd2dc;

  color: var(--text);
}

/* =========================================
   RESULT
========================================= */

.result-box {
  margin-top: 25px;

  min-height: 80px;

  padding: 15px 18px;

  display: flex;

  align-items: center;

  gap: 14px;

  background: linear-gradient(135deg, #f0fcf9, #f8fffd);

  border: 1px solid #ccefe8;

  border-radius: 15px;
}

.result-icon {
  width: 45px;
  height: 45px;

  display: grid;
  place-items: center;

  background: white;

  border-radius: 12px;

  font-size: 21px;

  box-shadow: var(--shadow-sm);
}

.result-box > div:nth-child(2) {
  flex: 1;
}

.result-box span {
  display: block;

  color: var(--primary-dark);

  font-size: 9px;

  font-weight: 800;

  letter-spacing: 0.8px;
}

.result-box strong {
  display: block;

  margin-top: 3px;

  color: var(--text);

  font-family: "Space Grotesk", sans-serif;

  font-size: 22px;
}

.copy-btn {
  border: 1px solid #cce7e2;

  background: white;

  color: var(--primary-dark);

  padding: 8px 12px;

  border-radius: 8px;

  font-size: 10px;

  font-weight: 700;

  transition: 0.2s ease;
}

.copy-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* =========================================
   FOOTER
========================================= */

.lab-footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 25px 6% 35px;
  display: flex;
  flex-direction: column;
  align-items: left-start;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 11px;
}

.lab-footer strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  margin-bottom: 4px;
}

.site-footer {
  margin-top: 30px;
  padding: 28px 6%;
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.footer-site-link {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  transition: 0.2s ease;
}

.footer-site-link:hover {
  color: var(--secondary);
}

.footer-copyright {
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

@media (max-width: 650px) {
  .site-footer {
    padding: 24px 5%;
  }

  .footer-content {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .footer-copyright {
    text-align: center;
    line-height: 1.7;
  }
}

.lat-content {
  margin-top: 60px;
}

.lat-content h2 {
  text-align: center;
  margin-bottom: 40px;
}

.content-section {
  margin-bottom: 50px;
}

.content-section h3 {
  margin-bottom: 20px;
}
/* =========================================
  RESPONSIVE
========================================= */

@media (max-width: 1000px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .calculator-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .sidebar-title {
    grid-column: 1 / -1;
  }

  .calculator-tab {
    margin: 0;
  }
}

@media (max-width: 720px) {
  .lab-header {
    padding: 18px 5%;
  }

  .header-badge {
    display: none;
  }

  .intro-section {
    padding: 45px 5% 25px;

    display: block;
  }

  .intro-text h2 {
    font-size: 42px;
  }

  .lab-illustration {
    display: none;
  }

  .calculator-section {
    padding: 20px 5% 60px;
  }

  .calculator-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar-title {
    grid-column: auto;
  }

  .card-header {
    display: block;
  }

  .formula {
    display: inline-block;

    margin-top: 18px;
  }

  .input-grid,
  .input-grid.four {
    grid-template-columns: 1fr;
  }

  .action-row {
    flex-direction: column;
  }

  .calculate-btn,
  .reset-btn {
    width: 100%;
  }

  .lab-footer {
    display: block;
    padding-left: 5%;
    padding-right: 5%;
  }

  .lab-footer > div:last-child {
    margin-top: 15px;
  }
}

@media (max-width: 450px) {
  .brand h1 {
    font-size: 18px;
  }

  .brand-icon {
    width: 45px;
    height: 45px;
    font-size: 23px;
  }

  .intro-text h2 {
    font-size: 35px;

    letter-spacing: -1.5px;
  }

  .calculator-card {
    padding: 20px 16px;
  }

  .result-box {
    flex-wrap: wrap;
  }

  .result-box > div:nth-child(2) {
    min-width: calc(100% - 65px);
  }

  .copy-btn {
    width: 100%;
  }
}

/* =========================================================
   PERIODIC TABLE
========================================================= */

.periodic-table-wrapper {
  width: 100%;
  overflow-x: auto;
  padding: 20px 0;
}

.periodic-table-container {
  width: 100%;
  min-width: 900px;
  overflow-x: auto;
}

.periodic-table {
  display: grid;

  grid-template-columns: repeat(18, minmax(48px, 1fr));

  grid-template-rows: repeat(9, 78px);

  gap: 5px;

  width: 100%;
  max-width: 1500px;

  margin: 0 auto;

  padding: 15px;

  box-sizing: border-box;
}

/* =========================================================
   ELEMENT CELL
========================================================= */

.element-cell {
  position: relative;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  text-align: center;

  border: 1px solid var(--primary);

  border-radius: 8px;

  background: linear-gradient(145deg, #ffffff, #ffffff);

  color: #070000;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;

  overflow: hidden;

  min-width: 0;
}

.element-cell:hover {
  transform: translateY(-4px) scale(1.04);

  z-index: 10;

  background: linear-gradient(145deg, #ffffff, #ffffff);

  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* =========================================================
   ATOMIC NUMBER
========================================================= */

.element-number {
  position: absolute;

  top: 5px;
  left: 6px;

  font-size: 10px;

  opacity: 0.75;
}

/* =========================================================
   SYMBOL
========================================================= */

.element-symbol {
  font-size: clamp(18px, 2vw, 27px);

  font-weight: 800;

  line-height: 1;

  margin-bottom: 5px;
}

/* =========================================================
   ELEMENT NAME
========================================================= */

.element-name {
  font-size: 9px;

  line-height: 1.1;

  opacity: 0.85;

  max-width: 95%;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

/* =========================================================
   ELEMENT TYPES
========================================================= */

.element-cell.alkali {
  border-color: #ff7675;
}

.element-cell.alkaline {
  border-color: #fdcb6e;
}

.element-cell.transition {
  border-color: #74b9ff;
}

.element-cell.post-transition {
  border-color: #a29bfe;
}

.element-cell.metalloid {
  border-color: #55efc4;
}

.element-cell.nonmetal {
  border-color: #81ecec;
}

.element-cell.halogen {
  border-color: #ffeaa7;
}

.element-cell.noble {
  border-color: #fab1a0;
}

.element-cell.lanthanide {
  border-color: #e84393;
}

.element-cell.actinide {
  border-color: #6c5ce7;
}

/* =========================================================
   F-BLOCK PLACEHOLDER
========================================================= */

.f-block-placeholder {
  border-style: dashed;
  opacity: 0.75;
}

/* =========================================================
   INFORMATION PANEL
========================================================= */

.element-info {
  position: fixed;

  left: 50%;
  bottom: 25px;

  transform: translate(-50%, 120%);

  width: min(92%, 560px);

  background: rgba(255, 255, 255, 0.98);

  color: rgb(0, 0, 0);

  border: 1px solid rgba(193, 255, 157, 0.15);

  border-radius: 16px;

  padding: 22px;

  box-sizing: border-box;

  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);

  z-index: 1000;

  opacity: 0;

  visibility: hidden;

  transition:
    transform 0.25s ease,
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.element-info.active {
  transform: translate(-50%, 0);

  opacity: 1;

  visibility: visible;
}

/* =========================================================
   INFO HEADER
========================================================= */

.info-header {
  display: flex;

  align-items: center;

  gap: 16px;

  margin-bottom: 20px;
}

.info-number {
  width: 65px;
  height: 65px;

  display: flex;

  justify-content: center;
  align-items: center;

  border-radius: 12px;

  background: linear-gradient(135deg, #3498db, #8e44ad);

  font-size: 25px;

  font-weight: 800;
}

.info-symbol {
  font-size: 32px;

  font-weight: 800;
}

.info-name {
  font-size: 17px;

  opacity: 0.75;
}

/* =========================================================
   INFO GRID
========================================================= */

.info-grid {
  display: grid;

  grid-template-columns: repeat(2, 1fr);

  gap: 10px;
}

.info-item {
  display: flex;

  flex-direction: column;

  gap: 5px;

  padding: 12px;

  border-radius: 9px;

  background: rgba(255, 255, 255, 0.055);
}

.info-item span {
  font-size: 11px;

  opacity: 0.6;
}

.info-item strong {
  font-size: 14px;

  word-break: break-word;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {
  .periodic-table-container {
    min-width: 900px;
  }

  .periodic-table {
    grid-template-rows: repeat(9, 65px);

    gap: 3px;

    padding: 8px;
  }

  .element-symbol {
    font-size: 17px;
  }

  .element-name {
    font-size: 7px;
  }

  .element-number {
    font-size: 8px;

    top: 3px;
    left: 4px;
  }

  .element-info {
    bottom: 10px;

    padding: 18px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
