/**
 * ============================================================
 * DONATION MODAL STYLESHEET - Enhanced with Security & Animations
 * ============================================================
 * Features:
 * - Responsive design for all screen sizes
 * - Smooth animations and transitions
 * - Input validation styling
 * - Security indicators
 * - Modern card-based UI
 * ============================================================
 */

/* ============================================================
   ANIMATIONS - Define keyframes for smooth transitions
   ============================================================ */

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(110, 214, 116, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(110, 214, 116, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 214, 116, 0); }
}

/* ============================================================
   MODAL OVERLAY - Background blur and darkening
   ============================================================ */

.popup-overlay,
#donate-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(5px);
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  overflow-y: auto;
  animation: fadeInScale 0.3s ease-out;
  padding: 20px;
  box-sizing: border-box;
}

.popup-overlay {
  display: none;
}

.popup-overlay.show {
  display: flex;
}

/* ============================================================
   MODAL CONTENT CONTAINER
   ============================================================ */

.popup-content,
#donate-modal .donation-content {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
              0 0 1px rgba(0, 0, 0, 0.1);
  position: relative;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px 24px;
  z-index: 10001;
  animation: slideInUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.popup-content::-webkit-scrollbar,
#donate-modal .donation-content::-webkit-scrollbar {
  width: 6px;
}

.popup-content::-webkit-scrollbar-track,
#donate-modal .donation-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.popup-content::-webkit-scrollbar-thumb,
#donate-modal .donation-content::-webkit-scrollbar-thumb {
  background: #6ed674;
  border-radius: 10px;
}

.popup-content::-webkit-scrollbar-thumb:hover,
#donate-modal .donation-content::-webkit-scrollbar-thumb:hover {
  background: #5ab85f;
}

/* ============================================================
   CLOSE BUTTON - Top right corner
   ============================================================ */

.close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  line-height: 1;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #000;
  transform: rotate(90deg);
}

/* ============================================================
   BACK BUTTON - Top left corner
   ============================================================ */

.back-btn {
  position: absolute;
  top: 16px;
  left: 20px;
  background: none;
  border: none;
  font-size: 0.95em;
  color: #6ed674;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.2s ease;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.back-btn:hover {
  color: #fff;
  background: #6ed674;
  transform: translateX(-4px);
}

.back-btn::before {
  content: '←';
}

/* ============================================================
   STEP INDICATOR - Visual progress bar
   ============================================================ */

.step-indicator {
  font-size: 0.95em;
  font-weight: 600;
  color: #fff;
  margin-bottom: 24px;
  text-align: center;
  width: 100%;
  padding: 16px;
  background: linear-gradient(to right, #6ed674 0%, #6ed674 calc(var(--progress, 33%) + 0), #e0e0e0 calc(var(--progress, 33%) + 0), #e0e0e0 100%);
  border-radius: 8px;
  font-weight: bold;
  animation: slideInDown 0.4s ease-out;
}

/* ============================================================
   DONATION STEP WRAPPER - Main step container
   ============================================================ */

.donation-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 8px 0;
  animation: slideInUp 0.4s ease-out;
}

.donation-step h2 {
  font-size: 1.8em;
  margin-bottom: 12px;
  color: #006400;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.donation-step label {
  font-size: 0.95em;
  color: #333;
  display: block;
  margin-bottom: 10px;
  text-align: left;
  font-weight: 500;
}

.donation-step p {
  color: #666;
  font-size: 0.9em;
  margin: 0;
}

/* ============================================================
   STEP CONTENT CONTAINERS
   ============================================================ */

#step-1,
.step-2-content,
#step-3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* ============================================================
   FORM INPUTS - Global styling with validation states
   ============================================================ */

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95em;
  font-family: inherit;
  box-sizing: border-box;
  transition: all 0.3s ease;
  background: #fafafa;
  color: #333;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="number"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: #999;
  font-weight: 400;
}

/* INPUT FOCUS STATE - Green highlight */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #6ed674;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(110, 214, 116, 0.15);
}

/* INPUT VALID STATE - Green checkmark */
input[type="text"].valid,
input[type="email"].valid,
input[type="number"].valid,
input[type="password"].valid {
  border-color: #4caf50;
  background: #f1f8f5;
}

/* INPUT INVALID STATE - Red highlight */
input[type="text"].invalid,
input[type="email"].invalid,
input[type="number"].invalid,
input[type="password"].invalid {
  border-color: #f44336;
  background: #ffebee;
  animation: shake 0.4s ease;
}

textarea {
  resize: vertical;
  height: 90px;
  min-height: 80px;
  max-height: 150px;
}

/* ============================================================
   CURRENCY SELECT DROPDOWN
   ============================================================ */

.currency-select {
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.95em;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.currency-select:hover {
  border-color: #6ed674;
}

.currency-select:focus {
  outline: none;
  border-color: #6ed674;
  box-shadow: 0 0 0 4px rgba(110, 214, 116, 0.15);
}

/* ============================================================
   DONATION TYPE BUTTONS (One-Time / Monthly)
   ============================================================ */

.donation-type {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
  flex-wrap: wrap;
}

.type-btn {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  padding: 12px 20px;
  border: 2px solid #e0e0e0;
  background: #fff;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95em;
}

.type-btn:hover {
  border-color: #6ed674;
  background: rgba(110, 214, 116, 0.05);
  transform: translateY(-2px);
}

.type-btn.active {
  background: linear-gradient(135deg, #6ed674 0%, #5ab85f 100%);
  color: #fff;
  border-color: #6ed674;
  box-shadow: 0 6px 16px rgba(110, 214, 116, 0.3);
  transform: translateY(-2px);
}

/* ============================================================
   AMOUNT BUTTONS & CUSTOM AMOUNT INPUT
   ============================================================ */

.amount-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

.amount-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, #fcee30 0%, #fce080 100%);
  border: 2px solid transparent;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 0.9em;
  flex: 0 1 auto;
  min-width: 70px;
  color: #333;
}

.amount-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(252, 238, 48, 0.4);
}

.amount-btn.active {
  background: linear-gradient(135deg, #111 0%, #333 100%);
  color: #fff;
  border-color: #111;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.custom-amount {
  max-width: 420px;
  padding: 12px 14px;
  width: 100%;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
  font-size: 0.95em;
  font-weight: 600;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.custom-amount:focus {
  border-color: #6ed674;
  box-shadow: 0 0 0 4px rgba(110, 214, 116, 0.15);
}

/* VALIDATION MESSAGE */
#amount-warning {
  color: #f44336;
  font-size: 0.85em;
  margin-top: 6px;
  display: none;
  animation: slideInUp 0.3s ease;
}

.validation-error {
  color: #f44336;
  font-size: 0.85em;
  margin-top: 6px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideInUp 0.3s ease;
}

.validation-error::before {
  content: '⚠️';
}

.validation-success {
  color: #4caf50;
  font-size: 0.85em;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideInUp 0.3s ease;
}

.validation-success::before {
  content: '✓';
}

/* ============================================================
   ACTION BUTTONS - Next, Back, Donate
   ============================================================ */

.next-btn,
#donate-button {
  width: 100%;
  max-width: 420px;
  padding: 13px 24px;
  margin-top: 8px;
  background: linear-gradient(135deg, #6ed674 0%, #5ab85f 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.95em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(110, 214, 116, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.next-btn:hover,
#donate-button:hover {
  background: linear-gradient(135deg, #5ab85f 0%, #4aa84d 100%);
  box-shadow: 0 8px 20px rgba(110, 214, 116, 0.35);
  transform: translateY(-2px);
}

.next-btn:active,
#donate-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(110, 214, 116, 0.25);
}

.next-btn:disabled,
#donate-button:disabled {
  background: linear-gradient(135deg, #ccc 0%, #aaa 100%);
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

/* ============================================================
   CARD PAYMENT FIELDS - Secure payment section
   ============================================================ */

.card-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

.card-input-wrapper input {
  flex: 1;
  max-width: none;
}

#card-element {
  max-width: 420px;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  box-sizing: border-box;
}

/* ============================================================
   ERROR & SUCCESS MESSAGES
   ============================================================ */

#card-errors,
#donation-status {
  font-size: 0.9em;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  animation: slideInUp 0.3s ease;
}

#card-errors {
  color: #d32f2f;
  background: #ffebee;
  border-left: 4px solid #d32f2f;
  display: none;
}

#card-errors.show {
  display: block;
}

#donation-status {
  color: #1976d2;
  background: #e3f2fd;
  border-left: 4px solid #1976d2;
  display: none;
  font-weight: 500;
}

#donation-status.show {
  display: block;
}

#donation-status.success {
  color: #2e7d32;
  background: #e8f5e9;
  border-left-color: #2e7d32;
}

#donation-status.error {
  color: #d32f2f;
  background: #ffebee;
  border-left-color: #d32f2f;
}

/* ============================================================
   DONATION SUMMARY - Total display
   ============================================================ */

.donation-summary {
  font-size: 1.15em;
  font-weight: 700;
  margin: 20px 0;
  padding: 16px;
  color: #006400;
  background: #f0f9f0;
  border-radius: 8px;
  border-left: 4px solid #6ed674;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#total-value {
  font-size: 1.2em;
  font-weight: 800;
  color: #006400;
}

/* ============================================================
   SECURITY INDICATORS & PAYMENT ICONS
   ============================================================ */

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85em;
  color: #2e7d32;
  margin: 16px 0;
  padding: 12px;
  background: #e8f5e9;
  border-radius: 8px;
  border: 1px solid #4caf50;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

.security-badge::before {
  content: '🔒';
  font-size: 1.2em;
}

.payment-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.payment-icons i {
  font-size: 1.8em;
  color: #666;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.payment-icons i:hover {
  opacity: 1;
  transform: scale(1.1);
}

.payment-icons i.fab.fa-cc-visa { color: #1a1f71; }
.payment-icons i.fab.fa-cc-mastercard { color: #eb001b; }
.payment-icons i.fab.fa-cc-amex { color: #2e77bc; }
.payment-icons i.fab.fa-cc-discover { color: #ff6000; }
.payment-icons i.fab.fa-google-pay { color: #5f6368; }
.payment-icons i.fab.fa-apple-pay { color: #000; }

/* ============================================================
   CHECKBOX STYLING - Anonymous & Mailing List
   ============================================================ */

input[type="checkbox"] {
  cursor: pointer;
  accent-color: #6ed674;
}

label input[type="checkbox"] {
  margin-right: 8px;
  width: auto;
}

/* ============================================================
   RESPONSIVE DESIGN - Mobile optimizations
   ============================================================ */

/* TABLET (768px and below) */
@media (max-width: 768px) {
  .popup-content,
  #donate-modal .donation-content {
    padding: 24px 18px;
    max-width: 95%;
    margin: 0 auto;
  }

  .close-btn {
    top: 12px;
    right: 14px;
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .back-btn {
    top: 12px;
    left: 14px;
    font-size: 0.9em;
    padding: 6px 10px;
  }

  .donation-step h2 {
    font-size: 1.5em;
    margin-bottom: 12px;
  }

  .step-indicator {
    font-size: 0.9em;
    padding: 12px;
    margin-bottom: 18px;
  }

  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    max-width: 100%;
    padding: 11px 12px;
    font-size: 1em;
  }

  .currency-select {
    max-width: 100%;
  }

  .next-btn,
  #donate-button,
  .donation-summary {
    max-width: 100%;
  }

  .donation-type {
    gap: 12px;
  }

  .type-btn {
    max-width: calc(50% - 6px);
    padding: 11px 16px;
    font-size: 0.9em;
  }

  .amount-options {
    gap: 10px;
  }

  .amount-btn {
    padding: 9px 16px;
    font-size: 0.85em;
    min-width: 65px;
  }

  .custom-amount {
    max-width: 100%;
  }

  .card-input-wrapper {
    max-width: 100%;
    flex-direction: column;
  }

  .card-input-wrapper input {
    width: 100%;
  }

  #card-element {
    max-width: 100%;
  }

  .donation-summary {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .security-badge {
    max-width: 100%;
    font-size: 0.8em;
  }

  .payment-icons i {
    font-size: 1.5em;
  }
}

/* MOBILE (425px and below) */
@media (max-width: 425px) {
  .popup-overlay,
  #donate-modal {
    padding: 16px;
    align-items: flex-end;
  }

  .popup-content,
  #donate-modal .donation-content {
    padding: 20px 16px;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    animation: slideInUp 0.3s ease-out;
  }

  .close-btn {
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 20px;
  }

  .back-btn {
    top: 10px;
    left: 12px;
    font-size: 0.85em;
    padding: 5px 8px;
  }

  .donation-step {
    gap: 14px;
  }

  .donation-step h2 {
    font-size: 1.3em;
    margin-bottom: 8px;
  }

  .step-indicator {
    font-size: 0.85em;
    padding: 10px;
    margin-bottom: 14px;
  }

  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    max-width: 100%;
    padding: 10px 11px;
    font-size: 16px;
    margin-bottom: 10px;
  }

  textarea {
    height: 70px;
  }

  .type-btn {
    max-width: 100%;
    padding: 10px 14px;
    font-size: 0.85em;
    min-width: auto;
    flex: 0 1 calc(50% - 6px);
  }

  .amount-btn {
    padding: 8px 14px;
    font-size: 0.8em;
    min-width: 60px;
  }

  .next-btn,
  #donate-button {
    max-width: 100%;
    padding: 12px 18px;
    font-size: 0.9em;
  }

  .donation-summary {
    max-width: 100%;
    font-size: 1em;
    padding: 12px;
  }

  #total-value {
    font-size: 1.1em;
  }

  .security-badge {
    max-width: 100%;
    font-size: 0.75em;
    padding: 10px;
  }

  .payment-icons {
    margin-top: 14px;
    margin-bottom: 12px;
  }

  .payment-icons i {
    font-size: 1.3em;
  }

  #card-errors,
  #donation-status {
    max-width: 100%;
    font-size: 0.85em;
  }
}

/* EXTRA SMALL MOBILE (375px and below) */
@media (max-width: 375px) {
  .popup-content,
  #donate-modal .donation-content {
    padding: 18px 14px;
  }

  .donation-step h2 {
    font-size: 1.2em;
  }

  .type-btn {
    flex: 0 1 calc(50% - 5px);
    padding: 9px 12px;
    font-size: 0.8em;
  }

  .amount-btn {
    padding: 8px 12px;
    font-size: 0.75em;
  }

  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    padding: 9px 10px;
    font-size: 16px;
  }

  .next-btn,
  #donate-button {
    padding: 11px 16px;
    font-size: 0.85em;
  }

  .donation-summary {
    font-size: 0.95em;
    padding: 10px;
  }
}

/* PRINT STYLES - Hide modal elements when printing */
@media print {
  .popup-overlay,
  #donate-modal,
  .close-btn,
  .back-btn {
    display: none !important;
  }
}
