/* ============================================================
   Masjid Donation Manager — Public Frontend
   Apple / iOS style  |  Font: Poppins  |  #007AFF accent
   ============================================================ */

/* Font Poppins dimuat secara dinamik melalui wp_enqueue_style apabila
   pentadbir mengaktifkan tetapan "Muat Google Fonts" dalam Tetapan plugin.
   Jika tidak diaktifkan, fallback fon sistem akan digunakan. */

:root {
  --masjiddm-blue:      #007AFF;
  --masjiddm-blue-dark: #0051D5;
  --masjiddm-green:     #34C759;
  --masjiddm-red:       #FF3B30;
  --masjiddm-gray-1:    #1C1C1E;
  --masjiddm-gray-5:    #636366;
  --masjiddm-gray-8:    #C7C7CC;
  --masjiddm-gray-10:   #E5E5EA;
  --masjiddm-gray-11:   #F2F2F7;
  --masjiddm-white:     #FFFFFF;
  --masjiddm-radius:    14px;
  --masjiddm-shadow:    0 8px 28px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  --masjiddm-font:      'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Wrapper ─────────────────────────────────────────── */
.masjiddm-wrapper {
  font-family: var(--masjiddm-font);
  max-width: 560px;
}

.masjiddm-campaign-image img {
  width: 100%;
  border-radius: var(--masjiddm-radius);
  margin-bottom: 16px;
  object-fit: cover;
  max-height: 240px;
}

.masjiddm-campaign-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--masjiddm-gray-1);
}

.masjiddm-campaign-desc {
  font-size: 14px;
  color: var(--masjiddm-gray-5);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ── Stats Bar ───────────────────────────────────────── */
.masjiddm-stats-bar {
  display: flex;
  gap: 0;
  background: var(--masjiddm-gray-11);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.masjiddm-stat {
  flex: 1;
  text-align: center;
}

.masjiddm-stat + .masjiddm-stat {
  border-left: 1px solid var(--masjiddm-gray-10);
}

.masjiddm-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--masjiddm-blue);
}

.masjiddm-stat-label {
  display: block;
  font-size: 12px;
  color: var(--masjiddm-gray-5);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Donate Button ───────────────────────────────────── */
.masjiddm-donate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 28px;
  background: var(--masjiddm-blue);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: var(--masjiddm-font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all .22s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 4px 16px rgba(0,122,255,.4);
  letter-spacing: 0.2px;
}

.masjiddm-donate-btn:hover {
  background: var(--masjiddm-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,122,255,.45);
}

.masjiddm-donate-btn:active { transform: translateY(0); }

.masjiddm-btn-icon { font-size: 18px; }

.masjiddm-campaign-ended {
  text-align: center;
  padding: 14px;
  background: var(--masjiddm-gray-11);
  border-radius: 12px;
  color: var(--masjiddm-gray-5);
  font-size: 14px;
  font-weight: 500;
}

/* ── Modal Overlay ───────────────────────────────────── */
.masjiddm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 20px;
  animation: mdmOverIn .2s ease;
}

@keyframes mdmOverIn { from { opacity: 0; } to { opacity: 1; } }

.masjiddm-modal {
  background: var(--masjiddm-white);
  border-radius: 22px;
  max-width: 440px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--masjiddm-shadow);
  animation: mdmModalIn .32s cubic-bezier(.34,1.56,.64,1);
  font-family: var(--masjiddm-font);
}

@keyframes mdmModalIn {
  from { transform: scale(.88) translateY(24px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── Modal Header ────────────────────────────────────── */
.masjiddm-modal-header {
  position: relative;
  text-align: center;
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--masjiddm-gray-10);
}

.masjiddm-modal-logo { margin-bottom: 12px; }
.masjiddm-modal-logo img { height: 52px; border-radius: 12px; object-fit: contain; }
.masjiddm-modal-logo-placeholder { font-size: 44px; }

.masjiddm-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--masjiddm-gray-1);
  margin: 0;
}

.masjiddm-modal-subtitle {
  font-size: 13px;
  color: var(--masjiddm-gray-5);
  margin: 4px 0 0;
  font-weight: 500;
}

.masjiddm-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--masjiddm-gray-11);
  border: none;
  font-size: 18px;
  color: var(--masjiddm-gray-5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all .18s;
}
.masjiddm-modal-close:hover { background: var(--masjiddm-red); color: white; }

/* ── Modal Body ──────────────────────────────────────── */
.masjiddm-modal-body { padding: 24px; }

.masjiddm-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--masjiddm-gray-5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ── Amount Grid ─────────────────────────────────────── */
.masjiddm-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.masjiddm-amount-btn {
  padding: 14px 10px;
  background: var(--masjiddm-gray-11);
  border: 2px solid transparent;
  border-radius: 12px;
  font-family: var(--masjiddm-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--masjiddm-gray-1);
  cursor: pointer;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  text-align: center;
}

.masjiddm-amount-btn:hover {
  background: var(--masjiddm-gray-10);
  border-color: var(--masjiddm-blue);
  color: var(--masjiddm-blue);
}

.masjiddm-amount-btn.selected {
  background: rgba(0,122,255,.08);
  border-color: var(--masjiddm-blue);
  color: var(--masjiddm-blue);
  box-shadow: 0 0 0 3px rgba(0,122,255,.12);
}

/* ── Custom Amount ───────────────────────────────────── */
.masjiddm-custom-amount-wrapper {
  margin-bottom: 20px;
}

.masjiddm-custom-amount-wrapper label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--masjiddm-gray-1);
}

.masjiddm-input-prefix {
  display: flex;
  align-items: center;
  border: 2px solid var(--masjiddm-gray-10);
  border-radius: 12px;
  overflow: hidden;
  background: var(--masjiddm-gray-11);
  transition: border-color .18s;
}

.masjiddm-input-prefix:focus-within {
  border-color: var(--masjiddm-blue);
  background: var(--masjiddm-white);
  box-shadow: 0 0 0 3px rgba(0,122,255,.12);
}

.masjiddm-input-prefix span {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--masjiddm-gray-5);
  background: transparent;
  border-right: 1px solid var(--masjiddm-gray-10);
}

.masjiddm-custom-amount {
  flex: 1;
  padding: 12px 14px;
  border: none;
  background: transparent;
  font-family: var(--masjiddm-font);
  font-size: 18px;
  font-weight: 700;
  color: var(--masjiddm-gray-1);
  outline: none;
  width: 100%;
}

/* ── Next Button ─────────────────────────────────────── */
.masjiddm-btn-next {
  width: 100%;
  padding: 15px;
  background: var(--masjiddm-blue);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: var(--masjiddm-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(0,122,255,.4);
}
.masjiddm-btn-next:hover:not(:disabled) {
  background: var(--masjiddm-blue-dark);
  transform: translateY(-1px);
}
.masjiddm-btn-next:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Step 2: Fee Preview ─────────────────────────────── */
.masjiddm-fee-preview {
  background: var(--masjiddm-gray-11);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}

.masjiddm-fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--masjiddm-gray-1);
  border-bottom: 1px solid rgba(0,0,0,.04);
}

.masjiddm-fee-row:last-child { border-bottom: none; }
.masjiddm-fee-row span:first-child { color: var(--masjiddm-gray-5); }
.masjiddm-fee-row span:last-child  { font-weight: 600; }

.masjiddm-fee-total {
  margin-top: 4px;
  padding-top: 12px !important;
  border-top: 1px solid var(--masjiddm-gray-10) !important;
}
.masjiddm-fee-total span:first-child { font-weight: 700; color: var(--masjiddm-gray-1) !important; }
.masjiddm-fee-total span:last-child  { font-size: 18px; font-weight: 800; color: var(--masjiddm-blue) !important; }

/* ── Anon Toggle ─────────────────────────────────────── */
.masjiddm-anon-toggle { margin-bottom: 16px; }

.masjiddm-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--masjiddm-gray-1);
  user-select: none;
}

.masjiddm-toggle-label input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }

.masjiddm-toggle-slider {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--masjiddm-gray-8);
  border-radius: 13px;
  transition: all .2s;
  flex-shrink: 0;
}

.masjiddm-toggle-slider::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: all .2s;
}

.masjiddm-toggle-label input:checked + .masjiddm-toggle-slider { background: var(--masjiddm-green); }
.masjiddm-toggle-label input:checked + .masjiddm-toggle-slider::after { transform: translateX(18px); }

/* ── Donor Fields ────────────────────────────────────── */
.masjiddm-donor-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.masjiddm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.masjiddm-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--masjiddm-gray-1);
}

.masjiddm-required { color: var(--masjiddm-red); }

.masjiddm-field input[type="text"],
.masjiddm-field input[type="email"],
.masjiddm-field input[type="tel"] {
  padding: 12px 14px;
  border: 2px solid var(--masjiddm-gray-10);
  border-radius: 12px;
  font-family: var(--masjiddm-font);
  font-size: 14px;
  color: var(--masjiddm-gray-1);
  background: var(--masjiddm-gray-11);
  outline: none;
  transition: all .18s;
}

.masjiddm-field input:focus {
  border-color: var(--masjiddm-blue);
  background: var(--masjiddm-white);
  box-shadow: 0 0 0 3px rgba(0,122,255,.12);
}

.masjiddm-field input.masjiddm-field-error {
  border-color: var(--masjiddm-red);
  background: rgba(255,59,48,.04);
  box-shadow: 0 0 0 3px rgba(255,59,48,.1);
}

/* ── Step Actions ────────────────────────────────────── */
.masjiddm-step-actions {
  display: flex;
  gap: 10px;
}

.masjiddm-btn-secondary {
  padding: 14px 20px;
  background: var(--masjiddm-gray-11);
  color: var(--masjiddm-gray-1);
  border: 1.5px solid var(--masjiddm-gray-10);
  border-radius: 14px;
  font-family: var(--masjiddm-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.masjiddm-btn-secondary:hover { background: var(--masjiddm-gray-10); }
.masjiddm-btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

.masjiddm-btn-primary {
  flex: 1;
  padding: 14px;
  background: var(--masjiddm-blue);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: var(--masjiddm-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(0,122,255,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.masjiddm-btn-primary:hover:not(:disabled) { background: var(--masjiddm-blue-dark); transform: translateY(-1px); }
.masjiddm-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Modal Footer ────────────────────────────────────── */
.masjiddm-modal-footer {
  padding: 14px 24px 20px;
  text-align: center;
  border-top: 1px solid var(--masjiddm-gray-10);
}

.masjiddm-modal-footer p {
  font-size: 12px;
  color: var(--masjiddm-gray-5);
}

/* ── Result States ───────────────────────────────────── */
.masjiddm-result-error,
.masjiddm-result-success {
  text-align: center;
  padding: 20px;
}

.masjiddm-result-icon { font-size: 48px; margin-bottom: 12px; }
.masjiddm-result-error h3 { color: var(--masjiddm-red); font-size: 17px; margin-bottom: 8px; }
.masjiddm-result-success h3 { color: var(--masjiddm-green); font-size: 17px; margin-bottom: 8px; }
.masjiddm-result-error p,
.masjiddm-result-success p { font-size: 14px; color: var(--masjiddm-gray-5); margin-bottom: 20px; }

/* ── Donor Wall ──────────────────────────────────────── */
.masjiddm-donor-wall {
  margin-top: 24px;
  padding: 20px;
  background: var(--masjiddm-gray-11);
  border-radius: 16px;
  font-family: var(--masjiddm-font);
}

.masjiddm-donor-wall-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--masjiddm-gray-1);
  margin-bottom: 14px;
}

.masjiddm-donor-wall-empty {
  text-align: center;
  color: var(--masjiddm-gray-5);
  font-size: 13px;
  padding: 12px;
}

.masjiddm-donor-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.masjiddm-donor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.masjiddm-donor-item:last-child { border-bottom: none; }

.masjiddm-donor-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--masjiddm-blue), #AF52DE);
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.masjiddm-donor-info { flex: 1; }
.masjiddm-donor-name { font-size: 13.5px; font-weight: 600; color: var(--masjiddm-gray-1); }
.masjiddm-donor-meta { font-size: 11.5px; color: var(--masjiddm-gray-5); margin-top: 1px; }

/* ── Stats Widget ────────────────────────────────────── */
.masjiddm-stats-widget {
  display: flex;
  gap: 12px;
  font-family: var(--masjiddm-font);
}

.masjiddm-stat-card {
  flex: 1;
  background: var(--masjiddm-white);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  text-align: center;
}

.masjiddm-stat-card .masjiddm-stat-icon { font-size: 24px; margin-bottom: 6px; }
.masjiddm-stat-card .masjiddm-stat-value { font-size: 22px; font-weight: 800; color: var(--masjiddm-blue); }
.masjiddm-stat-card .masjiddm-stat-label { font-size: 12px; color: var(--masjiddm-gray-5); font-weight: 500; margin-top: 2px; }

/* ── Campaigns Grid (shortcode) ─────────────────────── */
.masjiddm-campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  font-family: var(--masjiddm-font);
}

.masjiddm-campaign-card {
  background: var(--masjiddm-white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transition: transform .2s, box-shadow .2s;
}

.masjiddm-campaign-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.masjiddm-campaign-card .masjiddm-card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.masjiddm-card-body { padding: 18px; }

.masjiddm-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--masjiddm-gray-1);
  margin-bottom: 10px;
}

.masjiddm-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--masjiddm-gray-5);
  margin-bottom: 14px;
}

/* ── Return Alert ────────────────────────────────────── */
.masjiddm-return-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 50px;
  font-family: var(--masjiddm-font);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999999;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  animation: mdmSlideDown .4s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}

.masjiddm-alert-success { background: var(--masjiddm-green); color: white; }
.masjiddm-alert-error   { background: var(--masjiddm-red);   color: white; }

@keyframes mdmSlideDown {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.masjiddm-alert-close {
  background: rgba(255,255,255,.25);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Error text ──────────────────────────────────────── */
.masjiddm-error {
  color: var(--masjiddm-red);
  font-size: 13px;
  font-family: var(--masjiddm-font);
  padding: 10px;
  background: rgba(255,59,48,.06);
  border-radius: 8px;
}

.masjiddm-block-empty {
  color: #999;
  font-style: italic;
  font-family: var(--masjiddm-font);
  padding: 12px;
  border: 1px dashed #c7c7cc;
  border-radius: 8px;
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .masjiddm-modal-overlay { padding: 0; align-items: flex-end; }
  .masjiddm-modal { border-radius: 24px 24px 0 0; max-height: 96vh; }
  .masjiddm-amount-grid { grid-template-columns: repeat(2, 1fr); }
  .masjiddm-campaigns-grid { grid-template-columns: 1fr; }
  .masjiddm-stats-widget { flex-direction: column; }
}
