/* Reset & Base Styles */
:root {
  --primary: #4361ee;
  --secondary: #3f37c9;
  --accent: #7209b7;
  --dark: #1f2937;
  --light: #f9fafb;
  --gray: #6b7280;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background: var(--light);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.header {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--dark);
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.logo span {
  color: var(--primary);
}

/* ===== NAVIGATION ===== */
.navbar {
  display: flex;
}

.nav-list {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  text-decoration: none;
  color: var(--dark);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s;
}

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

.nav-link.active {
  color: var(--primary);
}

/* DESKTOP: Full width underline */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark);
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.mobile-menu-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
  .navbar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background: white;
    padding: 1rem 0;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    clip-path: circle(0% at 90% -10%);
    transition: clip-path 0.5s ease-in-out;
    z-index: 999;
    display: block;
  }

  .navbar.active {
    clip-path: circle(150% at 90% -10%);
  }

  .nav-list {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .nav-link {
    padding: 1rem 2rem;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    display: block; /* Ensure it's block level for mobile */
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  /* MOBILE: Center-aligned, shorter underline */
  .nav-link.active::after {
    left: 50%; /* Center the underline */
    transform: translateX(-50%); /* Center it properly */
    width: 40px; /* Shorter width for mobile */
    height: 3px; /* Slightly thicker for visibility */
    border-radius: 2px; /* Rounded ends */
  }

  .mobile-menu-btn {
    display: block;
    z-index: 1000;
  }
}

/* Hero Section */
.hero {
  background: linear-gradient(rgba(67, 97, 238, 0.9), rgba(58, 12, 163, 0.9)),
              url('https://images.unsplash.com/photo-1523050854058-8df90110c9f1?ixlib=rb-1.2.1&auto=format&fit=crop&w=1200&q=80');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: white;
  padding: 5rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.95;
}

.search-bar {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border-radius: 50px;
  overflow: hidden;
}

.search-bar input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: none;
  font-size: 1rem;
}

.search-bar input:focus {
  outline: 3px solid var(--accent);
  outline-offset: -2px;
}

.search-bar button {
  padding: 0 2rem;
  background: var(--dark);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  font-weight: 600;
}

.search-bar button:hover {
  background: #111827;
  transform: scale(1.05);
}

/* Bursary Listings */
.bursaries {
  padding: 4rem 0;
}

.bursaries h2 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2.2rem;
  color: var(--dark);
}

.filter-options {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 3rem;
}

.filter-options button {
  padding: 0.6rem 1.5rem;
  background: white;
  border: 2px solid var(--primary);
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
  color: var(--primary);
}

.filter-options button.active,
.filter-options button:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.bursary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.bursary-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
}

.bursary-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.card-content {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.field-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.field-icon i {
  background: rgba(67, 97, 238, 0.1);
  padding: 1rem;
  border-radius: 50%;
  transition: transform 0.3s;
}

.bursary-card:hover .field-icon i {
  transform: rotate(15deg);
}

.card-content h3 {
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
  color: var(--dark);
  line-height: 1.3;
}

.provider {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
  font-weight: 500;
}

.deadline {
  color: var(--danger);
  font-weight: 600;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.deadline.urgent {
  background: #fee2e2;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  display: inline-block;
}

.field {
  display: inline-block;
  background: #e0e7ff;
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  margin: 0.5rem 0;
  font-weight: 500;
}

.description {
  color: var(--dark);
  margin: 1.2rem 0;
  font-size: 0.95rem;
  line-height: 1.5;
  flex-grow: 1;
}

.btn-view {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s, transform 0.2s;
  cursor: pointer;
  margin-top: auto;
  align-self: flex-start;
}

.btn-view:hover {
  background: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-view-all {
  display: inline-block;
  padding: 0.8rem 2rem;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-view-all:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

/* Loading States */
.loading-state,
.no-results-message,
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  grid-column: 1 / -1;
  text-align: center;
}

.loading-state i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}

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

.no-results-message {
  color: var(--gray);
  font-size: 1.1rem;
}

.error-message {
  color: var(--danger);
  font-weight: 500;
}

/* Newsletter */
.newsletter {
  background: var(--dark);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.newsletter h2 {
  margin-bottom: 1rem;
  font-size: 2rem;
}

.newsletter p {
  margin-bottom: 2rem;
  opacity: 0.9;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.newsletter form {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.newsletter input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: none;
  font-size: 1rem;
}

.newsletter input:focus {
  outline: 3px solid var(--accent);
  outline-offset: -2px;
}

.newsletter button {
  padding: 0 2rem;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}

.newsletter button:hover {
  background: var(--secondary);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.7);
  padding-top: 60px;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 2.5rem;
  border: none;
  width: 90%;
  max-width: 700px;
  border-radius: 16px;
  position: relative;
  animation: fadeIn 0.4s ease-out;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content .field-icon {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-content .field-icon i {
  font-size: 3rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.close-btn {
  color: var(--gray);
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.modal-content h2 {
  color: var(--dark);
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.8rem;
}

.modal-content h3 {
  color: var(--dark);
  margin: 1.5rem 0 1rem;
}

.modal-content p {
  margin-bottom: 0.8rem;
  line-height: 1.6;
}

.modal-content hr {
  margin: 1.5rem 0;
  border: none;
  border-top: 2px solid #e5e7eb;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn-apply {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.3s, box-shadow 0.3s;
  flex: 1;
  justify-content: center;
  min-width: 150px;
}

.btn-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(67, 97, 238, 0.4);
  color: white;
}

.btn-close-modal {
  padding: 0.8rem 2rem;
  background: transparent;
  color: var(--gray);
  border: 2px solid var(--gray);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  flex: 1;
  min-width: 150px;
}

.btn-close-modal:hover {
  background: var(--gray);
  color: white;
  border-color: var(--gray);
}

/* Footer */
.footer {
  background: #111827;
  color: white;
  padding: 4rem 0 2rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-links h3 {
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  color: white;
}

.footer-links p {
  color: #d1d5db;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.footer-links a {
  display: block;
  color: #9ca3af;
  margin-bottom: 0.8rem;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: white;
  transform: translateX(5px);
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  transition: all 0.3s;
}

.social-links a:hover {
  background: var(--primary);
  transform: translateY(-3px);
}

.copyright {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid #374151;
  color: #9ca3af;
  font-size: 0.9rem;
}

.disclaimer {
  font-size: 0.8rem;
  margin-top: 1rem;
  color: #6b7280;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

button:focus,
input:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* Mobile Responsiveness */
@media (max-width: 768px) {
  /* FIX: Header container spacing */
  .header .container {
    padding: 0.5rem 1rem; /* Add padding on mobile */
  }

  /* FIX: Logo positioning - less margin on mobile */
  .logo {
    font-size: 1.5rem; /* Slightly smaller on mobile */
    margin-right: auto; /* Push hamburger to right */
  }

  /* FIX: Mobile menu button positioning */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; /* Minimum touch target */
    height: 44px; /* Minimum touch target */
    margin-left: auto; /* Push to far right */
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e5e7eb; /* Subtle border */
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
  }

  /* FIX: Mobile menu positioning and animation */
  .navbar {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0; /* Added for full width */
    width: 100%;
    background: white;
    padding: 1rem 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    clip-path: circle(0% at 50% -20%); /* Center the animation origin */
    transition: all 0.4s ease-in-out;
    z-index: 999;
    display: block;
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
  }

  .navbar.active {
    clip-path: circle(150% at 50% -20%);
    opacity: 1;
    transform: translateY(0);
    max-height: 500px; /* Enough for all menu items */
  }

  /* FIX: Better mobile menu items */
  .nav-list {
    flex-direction: column;
    align-items: stretch; /* Full width items */
    gap: 0;
    padding: 0 1rem;
  }

  .nav-link {
    padding: 1rem 1.5rem;
    width: 100%;
    text-align: left; /* Left align for better readability */
    border-bottom: 1px solid #f3f4f6;
    border-radius: 6px;
    margin: 0.25rem 0;
    transition: background-color 0.2s;
  }

  .nav-link:hover {
    background-color: #f9fafb;
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  /* FIX: Mobile active link styling */
  .nav-link.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    font-weight: 600;
    border-left: 4px solid var(--primary);
    padding-left: calc(1.5rem - 4px); /* Adjust for border */
  }

  .nav-link.active::after {
    display: none; /* Remove underline on mobile */
  }

  /* Rest of your existing mobile styles... */
  .hero h1 {
    font-size: 2rem;
    padding: 0 1rem;
  }

  .hero p {
    font-size: 1.1rem;
    padding: 0 1rem;
  }

  .search-bar,
  .newsletter form {
    flex-direction: column;
    border-radius: 12px;
    margin: 0 1rem;
  }

  .search-bar input,
  .newsletter input {
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
  }

  .search-bar button,
  .newsletter button {
    border-radius: 0 0 12px 12px;
    padding: 1rem;
  }

  .bursary-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  .filter-options {
    padding: 0 1rem;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 1.5rem;
  }

  .modal-actions {
    flex-direction: column;
  }

  .btn-apply,
  .btn-close-modal {
    width: 100%;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  /* FIX: Even smaller screens adjustment */
  .header .container {
    padding: 0.5rem;
  }

  .logo {
    font-size: 1.4rem;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
  }

  .nav-link {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  .hero {
    padding: 3rem 0;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .bursaries {
    padding: 2rem 0;
  }

  .bursaries h2 {
    font-size: 1.8rem;
  }

  .modal-content h2 {
    font-size: 1.5rem;
  }
}

/* FIX: Very small screens - additional adjustments */
@media (max-width: 360px) {
  .logo {
    font-size: 1.3rem;
  }

  .mobile-menu-btn {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .header .container {
    padding: 0.5rem 0.75rem;
  }
}