@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #d80027; /* Absa red */
  --primary-dark: #a3001d;
  --bg-color: #f8fafc;
  --text-dark: #0f172a;
  --text-light: #64748b;
  --white: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(226, 232, 240, 0.8);
  --shadow: 0 4px 15px -2px rgba(15, 23, 42, 0.04), 0 2px 10px -3px rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 15px 20px -5px rgba(15, 23, 42, 0.06), 0 8px 8px -5px rgba(15, 23, 42, 0.03);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header, .navbar {
  background-color: var(--white);
  padding: 0.75rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container, .logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--white);
  background-color: var(--primary);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: -0.5px;
}

nav a, .nav-link {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 500;
  font-size: 0.75rem;
  margin-left: 1.25rem;
  transition: color 0.2s ease;
}

nav a:hover, .nav-link:hover {
  color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-align: center;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(216, 0, 39, 0.15);
}

.btn-outline {
  border: 1px solid var(--glass-border);
  color: var(--text-dark);
  background: var(--white);
}

.btn-outline:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

/* Form Containers */
.form-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 1.5rem;
  width: 90%;
  max-width: 400px;
  margin: 2rem auto;
  box-shadow: var(--shadow);
}

.form-container.large {
  max-width: 650px;
}

.form-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.form-header h1 {
  font-size: 1.25rem;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.form-header p {
  color: var(--text-light);
  font-size: 0.75rem;
}

.form-group {
  margin-bottom: 1rem;
  position: relative;
}

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

.required {
  color: var(--primary);
  font-weight: bold;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  background-color: #ffffff;
  color: var(--text-dark);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(216, 0, 39, 0.08);
}

.form-row {
  display: flex;
  gap: 0.85rem;
}

.form-row .form-group {
  flex: 1;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.checkbox-group input {
  margin-top: 0.15rem;
  accent-color: var(--primary);
}

.checkbox-group label {
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.4;
}

.form-text {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

.form-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.form-text a:hover {
  text-decoration: underline;
}

/* Landing Page Hero */
.hero {
  background: radial-gradient(circle at top left, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 3.5rem 5%;
  text-align: center;
}

.hero h1 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 0.85rem;
  max-width: 480px;
  margin: 0 auto 1.25rem;
  opacity: 0.9;
}

/* Main Content Area */
.main-content {
  padding: 2.5rem 5%;
  max-width: 900px;
  margin: 0 auto;
}

/* Dashboard UI */
.dashboard-card {
  background: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.dashboard {
  max-width: 600px;
  margin: 1.5rem auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wallet-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}

.wallet-card h3 {
  font-weight: 500;
  font-size: 0.85rem;
  opacity: 0.9;
}

.wallet-balance {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0.5rem 0;
  letter-spacing: -0.5px;
}

.apply-btn {
  border-color: var(--primary);
  background-color: #fff5f6;
  color: var(--primary);
}

/* For main wallet stats, arrange in rows and columns */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

.wallet-grid > div {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}

/* For action cards, strictly arrange in 2 columns for a clean grid on mobile and desktop */
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.action-card {
  background: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 1rem 0.75rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.action-icon {
  font-size: 1.25rem;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 90%;
  width: 300px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  border-left: 3px solid var(--primary);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Modals */
.modal-overlay {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
}

.modal-content {
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 1.5rem !important;
}

/* Responsive Grid and Typography */
@media (max-width: 768px) {
  body {
    font-size: 0.8rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .hero h1 {
    font-size: 1.5rem;
  }
  
  .hero p {
    font-size: 0.8rem;
  }
  
  /* On very small phones, stack the wallet grid, but keep action grid as 2 columns */
  .wallet-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .form-container {
    padding: 1.25rem;
    margin: 1.5rem auto;
  }
  
  .dashboard-card {
    padding: 1rem;
  }
  
  #toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* Processing Page Styles */
.processing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  padding: 1.5rem;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.status-text {
  font-size: 1rem;
  color: var(--text-dark);
  margin-bottom: 1rem;
  font-weight: 500;
}

.result-container {
  display: none;
  background: var(--white);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border-top: 5px solid #10b981;
  max-width: 450px;
  width: 90%;
  margin: 3rem auto;
  text-align: center;
  animation: fadeIn 0.4s ease-out forwards;
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.approved-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 1rem 0;
  letter-spacing: -0.5px;
}

/* Index Page Styles */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}

.feature-card h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.feature-card p, .feature-card ul {
  color: var(--text-light);
  line-height: 1.5;
  font-size: 0.85rem;
}

.feature-card ul {
  padding-left: 1.25rem;
}

.eligibility-box {
  background: var(--glass-bg);
  padding: 1.5rem;
  border-radius: 10px;
  margin-top: 2rem;
  text-align: center;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.eligibility-box h2 {
  font-size: 1.25rem;
}

.eligibility-box p {
  margin-top: 0.75rem;
  color: var(--text-light);
  font-size: 0.85rem;
}
