/* ================================================
   Daily Sadaqa — Premium Dark Theme Stylesheet
   ================================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color Palette — Deep night sky tones */
  --bg-primary: #0b0f1a;
  --bg-card: rgba(18, 24, 43, 0.75);
  --bg-card-hover: rgba(24, 32, 56, 0.85);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);

  --text-primary: #eef2ff;
  --text-secondary: #8b95b8;
  --text-muted: #5a6380;

  --morning-accent: #f5a623;
  --morning-glow: rgba(245, 166, 35, 0.25);
  --morning-gradient: linear-gradient(135deg, #f5a623 0%, #f7c948 100%);

  --evening-accent: #7c5cbf;
  --evening-glow: rgba(124, 92, 191, 0.25);
  --evening-gradient: linear-gradient(135deg, #7c5cbf 0%, #a78bfa 100%);

  --success: #34d399;
  --danger: #f87171;
  --border: rgba(255, 255, 255, 0.07);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-btn: 0 4px 14px rgba(0, 0, 0, 0.3);

  --font: 'Outfit', sans-serif;
  --font-arabic: 'Amiri', serif;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Animated Background Orbs --- */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: float 18s ease-in-out infinite;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--morning-accent), transparent 70%);
  top: -100px;
  right: -80px;
  animation-delay: 0s;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--evening-accent), transparent 70%);
  bottom: 50px;
  left: -120px;
  animation-delay: -6s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  top: 50%;
  left: 50%;
  animation-delay: -12s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -40px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 25px) scale(0.95);
  }
}

/* --- App Container --- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 18px 40px;
}

/* --- Header --- */
.app-header {
  text-align: center;
  padding: 28px 0 20px;
}

.header-icon {
  font-size: 2.6rem;
  margin-bottom: 6px;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {

  0%,
  100% {
    text-shadow: 0 0 12px var(--morning-glow);
  }

  50% {
    text-shadow: 0 0 28px var(--morning-accent), 0 0 60px var(--morning-glow);
  }
}

.app-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--morning-accent), var(--evening-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 300;
  margin-top: 4px;
}

.date-display {
  margin-top: 12px;
  padding: 6px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  display: inline-block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
}

/* --- Stats Bar --- */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 12px;
  margin-bottom: 22px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* --- Sadaqa Cards --- */
.sadaqa-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 22px;
  margin-bottom: 20px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
}

.sadaqa-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.morning-icon-wrap {
  background: var(--morning-glow);
  box-shadow: 0 0 20px var(--morning-glow);
}

.evening-icon-wrap {
  background: var(--evening-glow);
  box-shadow: 0 0 20px var(--evening-glow);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.card-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* --- Amount Display --- */
.amount-display {
  text-align: center;
  padding: 20px 0;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.morning-card .amount-display {
  border-color: rgba(245, 166, 35, 0.15);
}

.evening-card .amount-display {
  border-color: rgba(124, 92, 191, 0.15);
}

.currency {
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-secondary);
  vertical-align: super;
  margin-right: 2px;
}

.amount-value {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1px;
  transition: color var(--transition);
}

.morning-card .amount-value {
  color: var(--morning-accent);
}

.evening-card .amount-value {
  color: var(--evening-accent);
}

.amount-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 4px;
}

/* --- Card Actions --- */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.amount-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition);
}

.amount-input::placeholder {
  color: var(--text-muted);
}

.amount-input:focus {
  background: var(--bg-input-focus);
  border-color: rgba(255, 255, 255, 0.15);
}

.amount-input::-webkit-inner-spin-button,
.amount-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input[type="number"] {
  -moz-appearance: textfield;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-btn);
}

.btn:active {
  transform: scale(0.96);
}

.btn-icon {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-add {
  background: var(--morning-gradient);
  color: #1a1a2e;
}

.evening-card .btn-add {
  background: var(--evening-gradient);
  color: #fff;
}

.btn-add:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-reduce {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-reduce:hover {
  background: rgba(248, 113, 113, 0.25);
  transform: translateY(-1px);
}

/* --- History Section --- */
.history-section {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.history-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: color var(--transition);
}

.history-toggle:hover {
  color: var(--text-secondary);
}

.toggle-arrow {
  transition: transform var(--transition);
  font-size: 0.7rem;
}

.history-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}

.history-list {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.history-list.open {
  max-height: 500px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.history-item:last-child {
  border-bottom: none;
}

.history-type {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-type .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.history-type .dot.add {
  background: var(--success);
}

.history-type .dot.reduce {
  background: var(--danger);
}

.history-amount {
  font-weight: 600;
}

.history-amount.positive {
  color: var(--success);
}

.history-amount.negative {
  color: var(--danger);
}

.history-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.history-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 14px 0;
}

/* --- Contribution Status Badge --- */
.contribution-status {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}

.status-pending {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-done {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
  animation: statusPop 0.4s ease;
}

@keyframes statusPop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  60% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Card glow when contributed */
.card-contributed {
  border-color: rgba(52, 211, 153, 0.2) !important;
  box-shadow: var(--shadow-card), 0 0 30px rgba(52, 211, 153, 0.08) !important;
}

/* --- Streak Calendar Section --- */
.streak-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  margin-bottom: 22px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

.streak-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.streak-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-icon {
  font-size: 1.3rem;
}

.streak-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.streak-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--morning-accent);
  background: var(--morning-glow);
  padding: 4px 14px;
  border-radius: 50px;
}

.streak-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.contributed {
  background: var(--success);
}

.legend-dot.missed {
  background: rgba(248, 113, 113, 0.6);
}

.legend-dot.today {
  background: transparent;
  border: 2px solid var(--morning-accent);
  box-shadow: 0 0 6px var(--morning-glow);
}

/* Streak Grid — 30 day dots */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 6px;
}

.day-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  cursor: default;
  transition: all var(--transition);
  position: relative;
}

.day-dot .dot-label {
  line-height: 1;
}

.day-dot.contributed {
  background: rgba(52, 211, 153, 0.2);
  color: var(--success);
  border: 1.5px solid rgba(52, 211, 153, 0.4);
}

.day-dot.missed {
  background: rgba(248, 113, 113, 0.1);
  color: rgba(248, 113, 113, 0.5);
  border: 1.5px solid rgba(248, 113, 113, 0.2);
}

.day-dot.today {
  border: 2px solid var(--morning-accent);
  color: var(--morning-accent);
  box-shadow: 0 0 10px var(--morning-glow);
  background: rgba(245, 166, 35, 0.1);
}

.day-dot.today.contributed {
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.2);
}

.day-dot:hover {
  transform: scale(1.3);
  z-index: 2;
}

/* --- Reset Section --- */
.reset-section {
  text-align: center;
  margin: 10px 0 24px;
}

.btn-reset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 28px;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-reset:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

/* --- Footer --- */
.app-footer {
  text-align: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.footer-quote {
  font-family: var(--font-arabic);
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto;
}

.footer-attr {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 500;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.3);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.3);
}

/* --- Amount change animation --- */
.amount-bump {
  animation: bump 0.35s ease;
}

@keyframes bump {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

/* --- Responsive --- */
@media (max-width: 520px) {
  .app-container {
    padding: 16px 14px 32px;
  }

  .sadaqa-card {
    padding: 20px 16px;
  }

  .amount-value {
    font-size: 2.2rem;
  }

  .stats-bar {
    padding: 14px 8px;
  }

  .stat-value {
    font-size: 1rem;
  }
}