* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background-color: #fbf8f1;
  color: #333333;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 2rem 1.5rem;
}

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  width: 100%;
  max-width: 1100px;
  align-items: start;
}

.calculator-form-container,
.calculator-result-container {
  background-color: #ffffff;
  border: 1px solid #eaeaea;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.calculator-form-container {
  gap: 1.5rem;
}

.section-title {
  font-size: 1.6rem;
  color: #1b4332;
  border-bottom: 2px solid #ffb300;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.row-input {
  gap: 0.3rem;
}

.row-input label {
  font-weight: 500;
  color: #333;
  font-size: 1rem;
}

.input-with-prefix {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #fff;
  overflow: hidden;
  transition: all 0.2s ease;
}

.input-with-prefix:focus-within {
  border-color: #03522f;
  box-shadow: 0 0 0 2px rgba(3, 82, 47, 0.15);
}

.input-with-prefix .prefix {
  padding: 0.8rem 0.5rem 0.8rem 1rem;
  color: #333;
  font-weight: 500;
  background-color: #fff;
}

.input-with-prefix input {
  flex: 1;
  border: none;
  padding: 0.8rem 1rem 0.8rem 0.5rem;
  font-size: 1rem; /* Minimum 16px to prevent zoom */
  outline: none;
  background: transparent;
  color: #333;
}

.readonly-input {
  background-color: #f3f4f6;
}

.readonly-input .prefix {
  background-color: transparent;
}

.readonly-input input {
  color: #4b5563;
}

.mt-3 {
  margin-top: 1.5rem;
}

.helper-text-red {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.input-emas-block {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px dashed #ddd;
}

.input-emas-block.hidden {
  display: none;
}

.form-group select,
.form-group > input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 1rem; /* Minimum 16px to prevent zoom */
  background-color: #fff;
  color: #1f2937;
  outline: none;
  transition: all 0.2s ease;
  min-height: 48px;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2303522f%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat, repeat;
  background-position:
    right 1em top 50%,
    0 0;
  background-size:
    0.65em auto,
    100%;
  font-weight: 600;
}

.form-group select:focus,
.form-group > input:focus {
  border-color: #03522f;
  box-shadow: 0 0 0 4px rgba(3, 82, 47, 0.15);
}

.helper-text {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: -0.2rem;
}

.helper-emas {
  color: #d97706;
  font-weight: 500;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.4s ease;
}

.form-section.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.baznas-tabs {
  display: flex;
  border-bottom: 1px solid #cbd5e1;
  margin-bottom: 1rem;
}

.baznas-tab {
  padding: 0.8rem 1.5rem;
  background: none;
  border: 1px solid transparent;
  border-top-width: 3px;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  margin-bottom: -1px;
}

.baznas-tab.active {
  color: #03522f;
  background-color: #fff;
  border-color: #03522f #cbd5e1 #fff #cbd5e1;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.baznas-tab:hover:not(.active) {
  border-color: transparent transparent #cbd5e1 transparent;
  color: #03522f;
}

.tab-content {
  animation: fadeIn 0.3s ease;
}

.tab-content.hidden {
  display: none;
}

.baznas-buttons {
  display: flex;
  gap: 1rem;
  width: 100%;
  margin-top: 1.5rem;
}

.btn {
  border: none;
  border-radius: 25px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.9rem;
  flex: 1;
}

.btn:active {
  transform: scale(0.96);
}

.baznas-btn-reset {
  background-color: #ffc107;
  color: #333;
}

.baznas-btn-reset:hover {
  background-color: #ffb300;
}

.baznas-btn-hitung {
  background-color: #03522f;
  color: #fff;
}

.baznas-btn-hitung:hover {
  background-color: #024024;
}

.baznas-btn-sedekah {
  background-color: #03522f;
  color: #fff;
  width: auto;
  padding: 0.7rem 2rem;
  margin-top: 1rem;
  align-self: center;
}

.baznas-btn-sedekah:hover {
  background-color: #024024;
}

.inline-message {
  margin-top: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.inline-message.hidden {
  display: none;
}

.inline-message p {
  color: #333;
  font-size: 1rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  min-height: 300px;
  padding: 2.5rem 1.5rem;
  color: #4b5563;
  background-color: #f8fafc;
  border-radius: 12px;
  border: 2px dashed #cbd5e1;
  animation: fadeIn 0.4s ease;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  margin-bottom: 1.5rem;
  background-color: #ecfdf5;
  padding: 1.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h3 {
  margin-bottom: 0.75rem;
  color: #03522f;
  font-size: 1.4rem;
  font-weight: 700;
}

.empty-state .empty-desc {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: #64748b;
}

.info-boxes {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.info-box {
  flex: 1;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.info-box strong {
  color: #03522f;
  font-size: 0.9rem;
}

.info-box span {
  font-size: 0.8rem;
  color: #64748b;
}

.result-box {
  padding: 2rem;
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  border-top: 5px solid #03522f;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.4s ease;
  flex: 1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.result-box.hidden {
  display: none;
}

.result-header {
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 1rem;
}

.result-header h3 {
  color: #03522f;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.result-header p {
  color: #6b7280;
  font-size: 0.9rem;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.result-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.result-label {
  color: #4b5563;
  font-size: 0.95rem;
  font-weight: 600;
}

.result-value {
  font-weight: 800;
  color: #1f2937;
  font-size: clamp(1.1rem, 5vw, 1.3rem);
}

.status-badge {
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-block;
  align-self: flex-start;
  margin-top: 0.3rem;
  letter-spacing: 0.5px;
}

.status-badge.wajib {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #10b981;
}

.status-badge.tidak-wajib {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

.zakat-amount {
  margin-top: 0.5rem;
  padding: 1.5rem;
  background-color: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.zakat-amount::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: #03522f;
}

.zakat-amount .result-label {
  color: #92400e;
}

.result-value.highlight {
  font-size: clamp(1.4rem, 8vw, 1.8rem);
  color: #b45309;
}

.zakat-note {
  font-size: 0.8rem;
  color: #b45309;
  opacity: 0.8;
}

footer {
  background-color: #03522f;
  color: #f4f1de;
  text-align: center;
  padding: 2.5rem;
  margin-top: 2rem;
}

footer p {
  font-size: 1.05rem;
  font-weight: 300;
}

@media (max-width: 900px) {
  .calculator-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .calculator-form-container,
  .calculator-result-container {
    padding: 2rem;
  }
}

@media (max-width: 600px) {
  .calculator-form-container,
  .calculator-result-container {
    padding: 1.5rem;
  }

  .baznas-tabs {
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: none;
  }

  .baznas-tab {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    margin-bottom: 0;
  }

  .baznas-tab.active {
    border-color: #03522f;
    border-width: 2px;
  }

  .info-boxes {
    flex-direction: column;
  }

  .baznas-buttons {
    flex-direction: column;
  }

  .baznas-btn-sedekah {
    width: 100%;
  }

  .result-box {
    padding: 1.5rem;
  }

  .zakat-amount {
    padding: 1rem;
  }
}
