/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0b0d17;
  --bg-card: rgba(17, 19, 35, 0.7);
  --bg-card-border: rgba(99, 102, 241, 0.15);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(99, 102, 241, 0.08);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #818cf8;
  --accent-bright: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #6366f1, #a78bfa, #c084fc);
  --success: #34d399;
  --border-radius: 16px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Background Glows ────────────────────────────────── */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -120px;
  left: -100px;
}

.bg-glow-2 {
  width: 400px;
  height: 400px;
  background: #a78bfa;
  bottom: 10%;
  right: -80px;
}

.bg-glow-3 {
  width: 300px;
  height: 300px;
  background: #c084fc;
  top: 50%;
  left: 40%;
}

/* ── Header ──────────────────────────────────────────── */
header {
  position: relative;
  z-index: 10;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.lang-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 4px;
}

.lang-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 20px 28px 40px;
  position: relative;
  z-index: 10;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 12px;
  max-width: 500px;
  margin-inline: auto;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  position: relative;
  z-index: 10;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeUp 0.5s ease-out both;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Calculator Grid ─────────────────────────────────── */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ── Inputs ───────────────────────────────────────────── */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0 14px;
  transition:
    border-color var(--transition),
    background var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  background: var(--bg-input-focus);
}

.input-wrapper .prefix,
.input-wrapper .suffix {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  user-select: none;
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 8px;
  width: 100%;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.3;
}

select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

select:focus {
  border-color: var(--accent);
  background-color: var(--bg-input-focus);
}

select option {
  background: #1a1d2e;
  color: var(--text);
}

/* ── Button ───────────────────────────────────────────── */
#calculateBtn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  background: var(--accent-gradient);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  margin-top: 8px;
}

#calculateBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

#calculateBtn:active {
  transform: translateY(0);
}

/* ── Results ──────────────────────────────────────────── */
.result-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.result-item.result-total {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.result-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.result-value.accent {
  color: var(--success);
}

/* ── Donut Chart ──────────────────────────────────────── */
.donut-section {
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: center;
}

.donut-chart-container {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-chart-container canvas {
  width: 100%;
  height: 100%;
}

.donut-center-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-pct {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-bright);
}

.donut-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.contrib-color {
  background: #6366f1;
}

.interest-color {
  background: var(--success);
}

/* ── Growth Chart ─────────────────────────────────────── */
.card-chart {
  max-width: 1100px;
  margin: 24px auto 0;
  padding-left: 28px;
  padding-right: 28px;
  animation-delay: 0.1s;
}

/* Remove extra padding from the card inside */
.card-chart {
  margin-left: auto;
  margin-right: auto;
  max-width: calc(1100px - 56px);
  margin-top: 24px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 340px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Table ────────────────────────────────────────────── */
.card-table {
  max-width: calc(1100px - 56px);
  margin: 24px auto 0;
  animation-delay: 0.15s;
}

.table-wrapper {
  max-height: 420px;
  overflow-y: auto;
  border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar {
  width: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

th {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

td:last-child {
  font-weight: 600;
  color: var(--text);
}

/* ── Advertisements ───────────────────────────────────── */
.ad-container {
  max-width: 1100px;
  margin: 0 auto 32px;
  padding: 0 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
  min-height: 90px; /* Minimum height for standard banner */
}

.ad-container::before {
  content: "Advertisement";
  position: absolute;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: -1;
}

.ad-banner ins {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  width: 100%;
}

.bottom-ad {
  margin-top: 32px;
  margin-bottom: 0;
}

/* ── Footer ───────────────────────────────────────────── */
footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 48px 28px 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 24px;
  }

  .donut-section {
    flex-direction: column;
  }

  .chart-container {
    height: 260px;
  }

  .card-chart,
  .card-table {
    margin-left: 28px;
    margin-right: 28px;
    max-width: none;
  }
}

@media (max-width: 480px) {
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.75rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .calculator-grid {
    padding: 0 16px;
  }

  .card {
    padding: 20px;
  }

  .card-chart,
  .card-table {
    margin-left: 16px;
    margin-right: 16px;
  }
}

/* ── Donation Header & Modal ──────────────────────────── */
.donation-btn-footer {
  margin-top: 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-bright);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}

.donation-btn-footer:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 13, 23, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #111323;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--border-radius);
  padding: 2.5rem 2rem;
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.modal-content h3 {
  font-size: 1.5rem;
  margin-bottom: 1.2rem;
  color: white;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-content p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.highlight-blue {
  color: var(--accent-bright);
  font-weight: 700;
}

.heart-text {
  font-weight: 600;
  margin-top: 1.5rem;
  color: white !important;
}

.receiver-text {
  margin-bottom: 1.5rem !important;
  font-size: 0.9rem !important;
}

.receiver-text strong {
  color: white;
}

.pix-section {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.pix-section h4 {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: white;
  font-weight: 600;
}

.pix-qr-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.pix-qr-img {
  width: 160px;
  height: 160px;
  background: white;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.pix-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.pix-code-container {
  background: #0b0d17;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.8rem;
}

.pix-code-container textarea {
  width: 100%;
  height: 80px;
  background: transparent;
  border: none;
  color: var(--success);
  font-family: monospace;
  font-size: 0.85rem;
  resize: none;
  outline: none;
  line-height: 1.4;
}

.pix-code-container textarea::-webkit-scrollbar {
  width: 4px;
}
.pix-code-container textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.copy-btn {
  background: var(--bg-card);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.close-modal-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s;
}

.close-modal-btn:hover {
  color: white;
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 0.4rem;
  }
  .modal-content {
    padding: 1rem 0.8rem;
    max-height: 98vh;
  }
  .modal-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  .modal-content p {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    line-height: 1.25;
  }
  .heart-text {
    margin-top: 0.4rem;
  }
  .receiver-text {
    margin-bottom: 0.6rem !important;
    font-size: 0.8rem !important;
  }
  .pix-section {
    padding: 0.6rem;
    margin-bottom: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .pix-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-align: center;
  }
  .pix-qr-container {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
  }
  .pix-qr-img {
    width: 100px;
    height: 100px;
  }
  .pix-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  .copy-btn {
    padding: 0.8rem;
    font-size: 0.85rem;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
  }
  .close-modal-btn {
    font-size: 0.85rem;
  }
}
