/* =========================================================
   GLOBAL THEME VARIABLES – LIGHT
========================================================= */
:root {
  /* ---------- BASE ---------- */
  --bg-body: #F3F4F6;
  --text-main: #111827;
  --text-muted: #6B7280;
  --link-color: #2563EB;

  /* ---------- HERO ---------- */
  --hero-bg: linear-gradient(to right, #107557, #0F8459, #0F5A55);
  --hero-title-bg: #F0F8FF;
  --hero-title-text: #111;
  --hero-subtitle-text: #FFFFFF;

  /* ---------- SECTION ---------- */
  --section-title-text: darkgreen;
  --section-divider: #16A34A;

  /* ---------- CARDS ---------- */
  --card-bg: #FFFFFF;
  --card-border: #E5E7EB;
  --card-shadow: 0 8px 24px rgba(2, 6, 23, .06);
  --card-shadow-hover: 0 14px 28px rgba(2, 6, 23, .12);

  /* ---------- INPUTS ---------- */
  --input-bg: #FFFFFF;
  --input-border: #D1D5DB;
  --input-border-focus: #10B981;
  --input-text: #111827;

  /* ---------- BUTTONS ---------- */
  --btn-main-bg: #16A34A;
  --btn-main-text: #FFFFFF;
  --btn-main-hover: #15803D;

  --btn-secondary-bg: #F9FAFB;
  --btn-secondary-text: #374151;
  --btn-secondary-border: #D1D5DB;

  /* ---------- RESULTS ---------- */
  --result-bg: #ECFDF5;
  --result-text: #065F46;

  /* ---------- MODAL ---------- */
  --overlay-bg: rgba(0, 0, 0, .6);
  --modal-bg: #FFFFFF;

  /* ---------- RADIUS ---------- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* HISTORY */
  --history-bg: #ffffff;
  --history-border: #e5e7eb;
  --history-shadow: 0 6px 20px rgba(0, 0, 0, .08);
  --history-title: #0f5a55;

  --history-item-border: #e5e7eb;
  --history-item-bg: transparent;
  --history-text: #111827;
}

/* =========================================================
   GLOBAL THEME VARIABLES – DARK
========================================================= */
.invert-root {
  --bg-body: #252525;
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --link-color: #38BDF8;

  --hero-bg: linear-gradient(to right, #064E3B, #065F46, #064E3B);
  --hero-title-bg: white;
  --hero-title-text: #000000;
  --hero-subtitle-text: #E5E7EB;

  --section-title-text: #A7F3D0;
  --section-divider: #22C55E;

  --card-bg: #313131;
  --card-border: #334155;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, .6);
  --card-shadow-hover: 0 14px 28px rgba(0, 0, 0, .85);

  --input-bg: #CECECE;
  --input-border: #334155;
  --input-border-focus: #34D399;
  --input-text: #F1F5F9;

  --btn-main-bg: #22C55E;
  --btn-main-text: #020617;
  --btn-main-hover: #16A34A;

  --btn-secondary-bg: #020617;
  --btn-secondary-text: #CBD5F5;
  --btn-secondary-border: #334155;

  --result-bg: #022C22;
  --result-text: #ffffff;

  --overlay-bg: rgba(0, 0, 0, .75);
  --modal-bg: #020617;

  --history-bg: #1f2937;
  --history-border: #374151;
  --history-shadow: 0 8px 30px rgba(0, 0, 0, .6);
  --history-title: #A7F3D0;

  --history-item-border: #374151;
  --history-item-bg: transparent;
  --history-text: #F3F4F6;
}

/* =========================================================
   BASE
========================================================= */
body {
  margin: 0;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: "Nunito", sans-serif;
}

a {
  color: var(--link-color);
}

/* =========================================================
   HERO
========================================================= */
.hero {
  background: var(--hero-bg);
  color: var(--hero-subtitle-text);
  text-align: center;
  padding: 65px 12px;
}

.hero h1 {
  background: var(--hero-title-bg);
  color: var(--hero-title-text);
  font-weight: 900;
  padding: 8px 22px;
  border-radius: 28px;
  width: fit-content;
  margin: 0 auto 24px;
}

.hero h3 {
  font-family: "Playpen Sans", sans-serif;
  font-weight: 400;
}

/* =========================================================
   SECTION TITLE
========================================================= */
.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 24px;
  color: var(--section-title-text);
}

.section-title::after {
  content: "";
  display: block;
  width: 80px;
  height: 3px;
  background: var(--section-divider);
  margin: 8px auto 0;
  border-radius: 2px;
}

/* =========================================================
   GRID
========================================================= */
.calculators-grid {
  max-width: 1200px;
  margin: 75PX auto 80px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

/* =========================================================
   CARD
========================================================= */
.calculator-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--card-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}

.calculator-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.calculator-card:last-of-type {
  position: relative;
  overflow: hidden;
  filter: grayscale(70%);
  opacity: 0.8;
}

/* Overlay */
.calculator-card:last-of-type::after {
  content: "Coming Soon / Очаквайте скоро";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  letter-spacing: 1px;
  backdrop-filter: blur(3px);
}

/* блокира кликове */
.calculator-card:last-of-type * {
  pointer-events: none;
}

/* =========================================================
   CARD HEADER
========================================================= */

.calculator-header h3 {
  margin: 0 0 25px;
  color: var(--section-title-text);
  display: flex;
  justify-content: left;
  align-items: center;
  gap: 10px;
  flex-direction: row;
  font-weight: 800;
}

.calculator-desc {
  display: block;
  font-size: .9rem;
  color: var(--text-muted);
}

/* =========================================================
   FORM
========================================================= */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 6px;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
}

.input-group input:focus {
  outline: none;
  border-color: var(--input-border-focus);
}


.invert-root input,
.invert-root .input-group select {
  color: black;
  font-weight: 700;
}


/* =========================================================
   BUTTONS
========================================================= */
.calculate-btn {
  width: 100%;
  background: var(--btn-main-bg);
  color: var(--btn-main-text);
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.calculate-btn:hover {
  background: var(--btn-main-hover);
}

/* =========================================================
   RESULT
========================================================= */
.calculator-result {
  margin-top: 18px;
  background: var(--result-bg);
  color: var(--result-text);
  border-radius: var(--radius-md);
  padding: 18px;
}

.result-value {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
}

/* =========================================================
   SOLUTION MODAL
========================================================= */
#solution-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#solution-overlay.open {
  display: flex;
}

.solution-modal {
  background: var(--modal-bg);
  padding: 28px;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 26px;
  background: none;
  border: none;
  cursor: pointer;
}




/* =========================================================
  SOLUTION BUTTON
========================================================= */

.solution-btn {
  display: inline-block;
  margin: 15px auto 0;
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.solution-btn:hover {
  background-color: var(--btn-secondary-text);
  color: var(--btn-secondary-bg);
  border-color: var(--btn-secondary-text);
  transform: translateY(-2px);
}



/* =========================================================
  SOLUTION OVERLAY
========================================================= */

#solution-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#solution-overlay.open {
  display: flex;
}

.solution-modal {
  background: var(--modal-bg);
  max-width: 600px;
  width: 90%;
  padding: 28px;
  border-radius: var(--radius-lg);
  position: relative;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 26px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  font-weight: 700;
  transition: all 0.2s ease;
}

.close-btn:hover {
  color: var(--btn-main-bg);
  transform: scale(1.1);
}







/* ===================== HISTORY ===================== */

.history-section {
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 20px;
}

.history-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--history-title);
  margin-bottom: 18px;
}

.history-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.history-list {
  background: var(--history-bg);
  border: 1px solid var(--history-border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--history-shadow);
  min-height: 120px;
  max-height: 380px;
  overflow-y: auto;
}

/* Empty state */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--history-text);
  opacity: .6;
  padding: 40px 20px;
  text-align: center;
}

.history-empty span {
  font-size: 42px;
  margin-bottom: 12px;
}

/* Items */
.history-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--history-item-border);
  color: var(--history-text);
  font-size: .95rem;
}

.history-item:last-child {
  border-bottom: none;
}


/* ===================== HISTORY BUTTONS ===================== */
.btn-secondary {
  padding: 12px 22px;
  background: var(--history-bg);
  color: var(--history-title);
  border: 2px solid var(--history-border);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--history-title);
  color: var(--history-bg);
  border-color: var(--history-title);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
  opacity: 0.9;
}