:root {
  --main-blue: #0057B7;
  --text-dark: #333333;
  --bg-light: #f8f9fa;
  --success-green: #28a745;
  --alert-red: #dc3545;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-dark);
  background-color: #f4f6f9;
}

.wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ХЕДЕР */
header {
  height: 70px;
  background: var(--main-blue);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
}
.header-title { font-size: 1.2em; font-weight: bold; margin-left: 10px; }

/* ОСНОВНА ЧАСТИНА */
.main-content {
  flex-grow: 1;
  padding: 40px 20px;
}

.container {
  max-width: 850px;
  margin: 0 auto;
}

h1 { text-align: center; color: #444; font-size: 28px; margin-bottom: 5px; }
.subtitle { text-align: center; color: #666; margin-bottom: 30px; font-size: 15px; }

/* КОНТЕЙНЕР КАЛЬКУЛЯТОРА */
.calculator-box {
  background: #ffffff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.unit-section {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
}
.unit-label { font-weight: bold; color: #555; }
.radio-label { cursor: pointer; display: flex; align-items: center; gap: 5px; }

/* СІТКА КАРТОК (2 колонки на ПК) */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

.calc-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.card-header {
  padding: 12px;
  font-weight: bold;
  color: white;
  text-align: center;
}
.card-header.before { background-color: var(--main-blue); }
.card-header.after { background-color: #6c757d; }

.card-body { padding: 20px; }
.optional-text { font-size: 11px; color: #888; margin-top: 0; margin-bottom: 15px; font-style: italic; text-align: center;}

.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.input-group label { font-size: 12px; font-weight: bold; color: #555; margin-bottom: 5px; }
.input-group input {
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 16px;
  text-align: center;
  transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--main-blue); outline: none; }

.action-section {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap;
}

/* Стиль для кнопки Очистити */
.btn-reset {
  background: #ffffff;
  color: #6c757d;
  border: 1px solid #ced4da;
  padding: 14px 25px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset:hover {
  background: #f8f9fa;
  color: #333333;
  border-color: #adb5bd;
}
.btn-calc {
  background: var(--main-blue);
  color: white;
  border: none;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  max-width: 300px;
}
.btn-calc:hover { background: #00418a; }

/* РЕЗУЛЬТАТИ */
.result-block {
  margin-top: 30px;
  padding: 20px;
  background: #e8f1fc;
  border-left: 5px solid var(--main-blue);
  border-radius: 4px;
  display: none; /* З'являється по кліку */
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 16px;
  border-bottom: 1px dashed #ced4da;
}
.result-item:last-child { border-bottom: none; }
.result-item strong { font-size: 1.3em; color: var(--main-blue); }

.dynamics-item { background: #fff; padding: 12px; border-radius: 4px; margin-top: 10px; box-shadow: inset 0 0 4px rgba(0,0,0,0.05); }
.text-decrease { color: var(--success-green) !important; }
.text-increase { color: var(--alert-red) !important; }

/* ФУТЕР */
.main-footer { background: #e9ecef; padding: 40px 20px 20px; border-top: 3px solid var(--main-blue); margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; }
.footer-col h4 { color: var(--main-blue); margin-top: 0; margin-bottom: 15px; }
.footer-col p { font-size: 14px; margin: 6px 0; line-height: 1.5; }
.disclaimer { font-size: 11px; color: #777; margin-top: 10px; }
.btn-group { display: flex; gap: 8px; margin-top: 10px; }
.btn { padding: 6px 12px; border-radius: 4px; color: white !important; text-decoration: none; font-size: 12px; font-weight: bold; }
.viber { background: #7360f2; } .telegram { background: #0088cc; } .whatsapp { background: #25d366; }
.footer-bottom { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid #ced4da; font-size: 12px; color: #777; }

/* АДАПТИВНІСТЬ ДЛЯ МОБІЛЬНИХ */
@media (max-width: 768px) {
  .action-section {
    flex-direction: column;
  }
  .calc-grid { grid-template-columns: 1fr; gap: 20px; }
  h1 { font-size: 22px; }
  .calculator-box { padding: 20px; }
  .result-item { flex-direction: column; text-align: center; gap: 5px; }
 .btn-calc, .btn-reset {
    width: 100%;
    max-width: 100%;
  }
}