/* XIRR Calculator Dedicated Styles */

:root {
  --bg: #f7f9fa;
  --card: #ffffff;
  --text: #39415b;
  --muted: #8a93a7;
  --primary: #00b386;
  --primary-soft: #e9faf5;
  --border: #e6ebf1;
  --track: #e9edf2;
  --returns: #5867e8;
  --invested: #d9deef;
  --shadow: 0 8px 20px rgba(22, 34, 51, 0.04);
  --radius: 14px;
  --deep-shadow: 0 18px 30px rgba(32, 45, 64, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at -10% -20%, #e9f6ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% -20%, #e8fff8 0%, transparent 55%),
    var(--bg);

  overflow-x: hidden;
}

.app {
  max-width: 1220px;
  margin: 0 auto;
  position: relative;
}

.page-title {
  margin: 0 0 24px 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #404863;
  text-align: center;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--deep-shadow);
  padding: 18px;
  animation: fadeUp 320ms ease-out;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #00b386 0%, #44d7b6 70%, #86e3ce 100%);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calc-shell {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  margin-bottom: 10px;
}

.left {
  padding-right: 2px;
}

.right {
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 700;
  color: #4d566f;
  border-bottom: 1px solid #eef2f6;
  padding-bottom: 10px;
}

.freq-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f9fbfd;
  border: 1px solid #edf2f7;
  border-radius: 10px;
}

.freq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 120ms ease;
  margin: 0;
}

.freq-item:hover {
  background: #eef5fb;
}

.freq-item input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.freq-item span {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  flex: 1;
}

.field {
  padding: 12px 10px;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  background: #ffffff;
  margin-bottom: 12px;
  transition: border-color 130ms ease, background 130ms ease;
}

.field:last-child {
  margin-bottom: 0;
}

.field:hover {
  border-color: #dce6ee;
  background: #fbfdff;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #ccece2;
  border-radius: 6px;
  padding: 6px 8px;
  background: #e4f6f0;
  min-width: 100%;
  justify-content: flex-end;
  transition: border-color 130ms ease, box-shadow 130ms ease;
  width: 100%;
}

.input:focus-within {
  border-color: #89d8c1;
  box-shadow: 0 0 0 2px rgba(0, 179, 134, 0.12);
}

.input input[type="date"],
.input input[type="number"] {
  border: none;
  outline: none;
  background: transparent;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #12a37f;
  cursor: pointer;
  flex: 1;
  text-align: right;
  padding: 2px 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.input input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  color: #12a37f;
}

.input input[type="number"]::-webkit-outer-spin-button,
.input input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input input[type="number"] {
  -moz-appearance: textfield;
}

.prefix {
  font-size: 13px;
  color: #129f7c;
  font-weight: 700;
}

.xirr-box {
  border: 2px solid var(--primary-soft);
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fbf7 0%, #e9faf5 100%);
  padding: 18px 14px;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0, 179, 134, 0.1);
  animation: slideInUp 400ms ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.xirr-caption {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  cursor: help;
  border: 1px solid var(--primary);
}

.xirr-value {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  padding: 4px 0;
  animation: popIn 400ms ease-out;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.chart-title {
  margin: 4px 0 8px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #4d566f;
  letter-spacing: 0.01em;
}

.chart-wrap {
  border-radius: 11px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 8px 2px 10px;
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 280px;
  border: 1px solid #eef2f6;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.chart-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  animation: fadeIn 320ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.legend-inline {
  width: 100%;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  transform: translateY(1px);
}

.dot.invest {
  background: var(--invested);
}

.dot.returns {
  background: var(--returns);
}

.sidebar {
  display: grid;
  gap: 14px;
}

.side-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.side-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(22, 34, 51, 0.08);
}

.promo {
  padding: 22px 18px;
  text-align: center;
}

.coin-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #f3fffb 0%, #dbf8f0 60%, #c7f0e4 100%);
  color: #11a781;
  font-size: 30px;
  font-weight: 800;
}

.promo h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: #3c445f;
  line-height: 1.1;
}

.promo p {
  margin: 8px 0 14px;
  font-size: 14px;
  color: #8b95a6;
}

.promo .btn-invest {
  width: 100%;
  margin: 0;
  border-radius: 7px;
}

.side-title {
  margin: 0;
  font-size: 16px;
  color: #4d566f;
  font-weight: 800;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f6;
}

.calc-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.calc-links li {
  border-bottom: 1px solid #eef2f6;
}

.calc-links li:last-child {
  border-bottom: none;
}

.calc-links a {
  display: block;
  text-decoration: none;
  color: #6a738a;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease;
}

.calc-links a:hover {
  background: #f7fbfd;
  color: #3f4964;
}

.btn-invest {
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #15bc91 0%, #0ea77f 100%);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 12px 28px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
  white-space: nowrap;
  box-shadow: 0 8px 14px rgba(14, 167, 127, 0.24);
}

.btn-invest:hover {
  background: #0ea77f;
}

.btn-invest:active {
  transform: translateY(1px);
}

/* Responsive Design */
@media (max-width: 900px) {
  body {
    padding: 12px;
  }

  .page-title {
    font-size: 28px;
    margin-bottom: 16px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 14px;
  }

  .calc-shell {
    grid-template-columns: 1fr;
  }

  .left {
    padding-right: 0;
  }

  .right {
    padding-left: 0;
  }

  .xirr-value {
    font-size: 32px;
  }

  .chart-wrap {
    min-height: 250px;
  }

  .freq-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
  }

  .freq-item {
    padding: 6px;
    font-size: 12px;
  }

  .sidebar {
    order: 2;
  }
}

@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .page-title {
    font-size: 22px;
    margin-bottom: 12px;
  }

  .card {
    padding: 12px;
  }

  .xirr-value {
    font-size: 28px;
  }

  .chart-wrap {
    min-height: 220px;
  }

  .freq-group {
    grid-template-columns: 1fr;
  }

  .input {
    min-width: 100%;
  }

  .legend-inline {
    gap: 8px;
    font-size: 11px;
  }

  .promo h2 {
    font-size: 20px;
  }
}
