/* Zakat Calculator Styles */

:root {
  --primary: #005b96;
  --primary-dark: #003f6b;
  --primary-light: #e8f1f8;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1f2933;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --accent: #fef3e6;
  --success: #059669;
}

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

html {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', 'Noto Nastaliq Urdu', sans-serif;
  background: linear-gradient(135deg, #e8f1f8 0%, #f8fafc 50%, #fef3e6 100%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
  padding-top: 70px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  border-bottom: 2px solid var(--border);
}

.top-navbar .nav-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-navbar .logo-link img {
  height: 50px;
  width: auto;
  display: block;
}

.top-navbar .nav-home {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.top-navbar .nav-home:hover {
  color: var(--primary-dark);
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 2rem 0;
}

h1 {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 2.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

.date-input {
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.date-input label {
  font-weight: 500;
  color: var(--text-muted);
}

.date-input input {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.rates-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-fetch-rates {
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-fetch-rates:hover {
  background: var(--primary-dark);
}

.btn-fetch-rates:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.rates-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rates-attribution {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
}

.rates-attribution:hover {
  text-decoration: underline;
}

.rates-fetch-failed {
  font-size: 0.8rem;
  color: #b45309;
  font-weight: 500;
}

.current-rates-card {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 91, 150, 0.06);
}

.current-rates-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
}

.current-rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem 1.25rem;
}

.rate-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rate-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rate-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--success);
}

.rate-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 91, 150, 0.08);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
}

.card-header:hover {
  opacity: 0.9;
}

.card-title {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.card-badge {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.card-content {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.card.collapsed .card-content {
  display: none;
}

.card.collapsed .chevron {
  transform: rotate(-90deg);
}

.chevron {
  transition: transform 0.2s ease;
  color: var(--primary);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-group.full {
  grid-column: 1 / -1;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-group input {
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-group input::placeholder {
  color: #94a3b8;
}

.gold-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gold-header {
  display: grid;
  grid-template-columns: 1fr minmax(90px, 1fr) minmax(100px, 1fr) minmax(110px, 1fr);
  gap: 0.75rem;
  padding: 0 0 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  direction: ltr;
}

.gold-header span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.gold-row {
  display: grid;
  grid-template-columns: 1fr minmax(90px, 1fr) minmax(100px, 1fr) minmax(110px, 1fr);
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  direction: ltr;
}

.gold-row input {
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.gold-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.gold-row label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
}

.gold-value {
  padding: 0.6rem 0.9rem;
  background: #f1f5f9;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--success);
  min-height: 42px;
  display: flex;
  align-items: center;
}

.section-total {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.section-total .zakat-amount {
  color: var(--success);
  font-size: 1.1rem;
}

.result-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2rem;
  border-radius: 20px;
  text-align: center;
  margin-top: 2rem;
  box-shadow: 0 10px 40px rgba(0, 91, 150, 0.3);
}

.result-card h2 {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.result-amount {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 1rem 0;
}

.result-details {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 1rem;
}

.btn-reset {
  margin-top: 1.5rem;
  padding: 0.75rem 2rem;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid white;
  color: white;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  background: white;
  color: var(--primary-dark);
}

.lang-toggle {
  display: inline-flex;
  gap: 0;
  background: var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 2rem;
}

header .lang-toggle {
  margin-left: auto;
  margin-right: auto;
}

.lang-toggle button {
  padding: 0.5rem 1.25rem;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.lang-toggle button.active {
  background: var(--card);
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lang-toggle button:hover:not(.active) {
  color: var(--text);
}

body.lang-en .card-title,
body.lang-en h1,
body.lang-en .result-card h2 {
  font-family: 'Inter', sans-serif;
}

@media (max-width: 600px) {
  .current-rates-grid {
    grid-template-columns: 1fr 1fr;
  }
  body {
    padding-top: 60px;
  }

  .container {
    padding: 1rem 0.75rem;
  }

  .top-navbar .nav-inner {
    padding: 0.5rem 0.75rem;
  }

  .top-navbar .logo-link img {
    height: 40px;
  }

  .top-navbar .nav-home {
    font-size: 0.85rem;
  }

  header {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .date-input {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .rates-row {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .rates-note {
    text-align: center;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card-title {
    font-size: 1rem;
    flex: 1;
    min-width: 0;
  }

  .card-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  /* Gold section - stacked layout on mobile */
  .gold-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding-bottom: 0.5rem;
  }
  .gold-header span:nth-child(1),
  .gold-header span:nth-child(4) {
    display: none;
  }

  .gold-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .gold-row label {
    grid-row: 1;
    grid-column: 1 / -1;
    text-align: left;
    font-size: 0.85rem;
  }

  .gold-row input[type="number"] {
    min-width: 0;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  .gold-row input[type="number"]:first-of-type {
    grid-row: 2;
    grid-column: 1;
  }

  .gold-row input[type="number"]:last-of-type {
    grid-row: 2;
    grid-column: 2;
  }

  .gold-row .gold-value {
    grid-row: 3;
    grid-column: 1 / -1;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    word-break: break-all;
    min-width: 0;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .section-total {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }

  .section-total .zakat-amount {
    font-size: 1rem;
    width: 100%;
    text-align: right;
  }

  .result-card {
    padding: 1.5rem;
    margin-top: 1.5rem;
  }

  .result-card h2 {
    font-size: 1.25rem;
  }

  .result-amount {
    font-size: 1.75rem;
  }

  .result-details {
    font-size: 0.85rem;
  }

  .btn-reset {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }
}
