/* CSS Variables - Brand Colors from Flutter Implementation */
:root {
  --brand-primary: #008000; /* Deep Blue */
  --brand-secondary: #daa520; /* Gold */
  --text-muted: #6b7280;
  --text-dark: #1f2937;
  --background-light: #f9fafb;
  --white: #ffffff;
  --error-color: #dc2626;
  --success-color: #059669;
  --border-color: #e5e7eb;
  --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-large: 0 10px 15px rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
  --border-radius-large: 16px;
  --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: linear-gradient(135deg, var(--brand-primary) 0%, #3b82f6 100%);
  min-height: 100vh;
}

/* Higher specificity to override Bootstrap's .container defaults */
body .donation-container.container {
  max-width: 1200px;
  margin-inline: auto;
  padding: 2rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-section {
  background: var(--white);
  padding: 1.25rem;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-large);
  margin-bottom: 0.5rem;
}

.logo {
  width: 120px;
  height: auto;
  margin-bottom: 1rem;
  object-fit: contain;
}

.header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.subtitle {
  color: var(--brand-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Two Column Layout */
.donation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.form-column {
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent overflow from inner content */
}

.reasons-column {
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent overflow from inner content */
}

/* Welcome Section */
.welcome-section {
  text-align: center;
  margin-bottom: 1rem;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
}

.avatar-placeholder span {
  font-size: 2rem;
  font-weight: bold;
  color: var(--white);
}

#welcomeMessage {
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Donation Card */
.donation-card {
  background: var(--white);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-large);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* Reasons Card */
.reasons-card {
  background: var(--white);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-large);
  overflow: hidden;
  border: 1px solid var(--border-color);
  height: fit-content;
}

.reasons-content {
  padding: 0 1rem 1rem;
}

.reason-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.reason-item:last-of-type {
  border-bottom: none;
  margin-bottom: 2rem;
}

.reason-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: rgba(30, 58, 138, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
}

.reason-text h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.reason-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Impact Stats */
.impact-stats {
  background: rgba(30, 58, 138, 0.05);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.impact-stats h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1rem;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-header {
  padding: 1rem 1rem 0;
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

/* Form Styles */
.donation-form {
  padding: 0 1rem 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--white);
}

.form-group input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-group input:invalid {
  border-color: var(--error-color);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* Select Dropdown Styles */
.donation-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--white);
  cursor: pointer;
}

.donation-select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Preset Amount Buttons */
.preset-amounts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.preset-btn {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--white);
  color: var(--text-dark);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.preset-btn:hover {
  border-color: var(--brand-primary);
  background: rgba(30, 58, 138, 0.05);
  transform: translateY(-1px);
}

.preset-btn.active {
  background: var(--brand-primary);
  color: var(--white);
  border-color: var(--brand-primary);
}

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

/* Error Messages */
.error-message {
  display: block;
  color: var(--error-color);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  min-height: 1rem;
}

.general-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error-color);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  margin-top: 1rem;
  font-size: 0.9rem;
}

.general-error.hidden {
  display: none;
}

/* Payment Button */
.payment-button {
  width: 100%;
  background: var(--brand-primary);
  color: var(--white);
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 50px;
}

.payment-button:hover:not(:disabled) {
  background: #1e40af;
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.payment-button:active {
  transform: translateY(0);
}

.payment-button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.button-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid var(--white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.button-spinner.hidden {
  display: none;
}

/* Security Note */
.security-note {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  backdrop-filter: blur(10px);
}

.security-icon {
  color: rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
}

.security-note p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  margin: 0;
}

/* Success Message */
.success-message {
  background: var(--white);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-large);
  border: 1px solid #d1fae5;
}

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

.success-icon {
  width: 60px;
  height: 60px;
  background: var(--success-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--white);
}

.success-message h3 {
  color: var(--success-color);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.success-message p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.reset-button {
  background: var(--brand-secondary);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.reset-button:hover {
  background: #b8860b;
  transform: translateY(-1px);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-content {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius-large);
  text-align: center;
  box-shadow: var(--shadow-large);
  max-width: 300px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.loading-content h3 {
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.loading-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
}

.footer p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-large);
  border-left: 4px solid var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: slideIn 0.3s ease-out;
}

.toast.error {
  border-left-color: var(--error-color);
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast-icon {
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

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

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .donation-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
    max-width: 600px;
  }
  .method-tabs { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 0.5rem;
    padding: 0.2rem;
  }
  .method-tab {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    min-height: 56px;
  }
  .method-tab i {
    font-size: 1.1rem;
  }
  .form-row.two-col { grid-template-columns: 1fr; }
  .logo-section {
    padding: 1.5rem;
  }
  .header h1 {
    font-size: 1.75rem;
  }
  .logo {
    width: 80px;
    height: auto;
  }
  .avatar-placeholder {
    width: 60px;
    height: 60px;
  }
  .avatar-placeholder span {
    font-size: 1.5rem;
  }
  #welcomeMessage {
    font-size: 1.25rem;
  }
  .toast {
    min-width: auto;
    margin: 0 1rem;
  }
  .toast-container {
    left: 20px;
    right: 20px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .reason-item {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  .reason-icon {
    align-self: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0.5rem;
  }
  .donation-card,
  .reasons-card {
    margin: 0;
  }
  .card-header,
  .donation-form,
  .reasons-content {
    padding: 1rem;
  }
  .form-group input,
  .donation-select {
    padding: 0.625rem 0.875rem;
  }
  .payment-button {
    padding: 0.75rem 1rem;
  }
  .preset-amounts {
    grid-template-columns: repeat(2, 1fr);
  }
  .preset-btn {
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
  }
  .impact-stats {
    padding: 1rem;
  }
  .stat-number {
    font-size: 1.25rem;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

.mb-0 {
  margin-bottom: 0 !important;
}

.mt-1 {
  margin-top: 0.5rem !important;
}

/* Focus Styles for Accessibility */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Payment Method Tabs */
.method-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.method-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--white);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  min-height: 60px;
}

.method-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 128, 0, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.method-tab i { 
  color: var(--brand-primary); 
  font-size: 1.25rem;
  transition: all 0.2s ease;
  z-index: 1;
  position: relative;
}

.method-tab span {
  z-index: 1;
  position: relative;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.method-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--brand-primary);
}

.method-tab:hover::before {
  opacity: 1;
}

.method-tab:hover i {
  transform: scale(1.1);
  color: var(--brand-primary);
}

.method-tab.active {
  background: linear-gradient(135deg, var(--brand-primary) 0%, #059669 100%);
  border-color: var(--brand-primary);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(0, 128, 0, 0.25);
  transform: translateY(-1px);
}

.method-tab.active::before {
  opacity: 0;
}

.method-tab.active i {
  color: var(--white);
  transform: scale(1.05);
}

.method-tab.active span {
  color: var(--white);
  font-weight: 700;
}

.method-tab:active {
  transform: translateY(0);
}

.method-tab:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.method-section { margin-bottom: 1rem; }

.method-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Two column helper */
.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Input with prefix */
.input-with-prefix {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  background: #f3f4f6;
  border: 2px solid var(--border-color);
  border-right: 0;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  color: var(--text-muted);
}

.input-with-prefix input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Info Panel / Bank details */
.info-panel {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
}

.info-panel h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.link-button {
  display: inline-block;
  margin-top: 0.5rem;
  background: var(--brand-primary);
  color: var(--white);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: var(--border-radius);
  font-weight: 600;
}

.link-button:hover { filter: brightness(0.95); }

.bank-details {
  padding-left: 1rem;
  color: var(--text-dark);
}

.bank-details li { margin: 0.25rem 0; }
