body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f8f9fa;
  overflow-x: hidden;
}

/* Better touch targets and tap highlight */
a, button, .btn, input, select, textarea {
  -webkit-tap-highlight-color: rgba(13, 110, 253, 0.15);
}

@media (max-width: 768px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Logo styling */
.logo-img {
  max-height: 60px;
  width: auto;
}

@media (max-width: 576px) {
  .logo-img {
    max-height: 44px;
  }
}

@media (max-width: 768px) {
  .logo-img {
    max-height: 50px;
  }
}

/* Site name typography */
.site-name-desktop {
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.site-name-mobile {
  font-size: clamp(0.9rem, 5vw, 1.1rem);
}

/* Button utilities */
.btn-no-min-width {
  min-width: 0;
}

/* Iframe styling */
.iframe-no-border {
  border: 0;
}

/* Heading utilities */
.heading-no-margin {
  margin: 0;
}

/* Form styling */
.form-inline-display {
  display: inline;
}

/* Login page styling */
.min-height-vh100 {
  min-height: 100vh;
}

/* Hero section with CSS variables */
.hero-section {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background: linear-gradient(135deg, #0d6efd 0%, #0d47a1 100%);
  min-height: 500px;
  position: relative;
}

@media (max-width: 768px) {
  .hero-section {
    min-height: 380px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
  .hero-section .display-5 {
    font-size: 1.75rem;
  }
  .hero-section .lead {
    font-size: 1rem;
  }
  .hero-section .btn-lg {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 576px) {
  .hero-section {
    min-height: 320px;
  }
  .hero-section .display-5 {
    font-size: 1.5rem;
  }
  .hero-section .d-flex.flex-wrap.gap-2 .btn {
    width: 100%;
  }
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.hero-section > div {
  position: relative;
  z-index: 2;
}

.impact-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e9ecef;
}

@media (max-width: 768px) {
  .impact-card {
    padding: 1.25rem;
  }
  .impact-card:hover {
    transform: none;
  }
}

.impact-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.1);
}

.impact-number {
  font-size: 3rem;
  font-weight: 700;
  color: #0d6efd;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.impact-label {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #6c757d;
  font-weight: 600;
}

.testimonial {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  border-left: 4px solid #0d6efd;
  font-style: italic;
}

.timeline {
  list-style: none;
  padding-left: 0;
  border-left: 3px solid #0d6efd;
  margin-left: 1rem;
}

.timeline li {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  position: relative;
}

.timeline-year {
  font-weight: 700;
  color: #0d6efd;
  font-size: 1.1rem;
}

.timeline-content {
  color: #495057;
  margin-top: 0.25rem;
}

.timeline li::before {
  content: '';
  width: 12px;
  height: 12px;
  background: #0d6efd;
  border-radius: 50%;
  position: absolute;
  left: -7.5px;
  top: 5px;
  border: 3px solid #f8f9fa;
  box-shadow: 0 0 0 2px #0d6efd;
}

.org-chart {
  text-align: center;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .org-chart {
    margin: 1rem 0;
  }
  .org-level {
    display: block;
    margin: 0.5rem auto;
    max-width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
  .org-connector {
    font-size: 1.25rem;
    margin: 0.25rem 0;
  }
}

.org-level {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  border: 2px solid #0d6efd;
  margin: 0.5rem;
  background: white;
  font-weight: 600;
  transition: all 0.3s ease;
}

.org-level:hover {
  background: #0d6efd;
  color: white;
  cursor: pointer;
}

.org-connector {
  font-size: 1.5rem;
  color: #0d6efd;
  margin: 0.5rem 0;
}

.news-ticker {
  font-size: 0.95rem;
  overflow: hidden;
  padding: 0.75rem 0;
}

.ticker-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow: hidden;
}

.ticker-label {
  flex-shrink: 0;
  white-space: nowrap;
}

.ticker-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ticker-text {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: scroll-ticker 20s linear infinite;
}

.ticker-content:hover .ticker-text {
  animation-play-state: paused;
}

@keyframes scroll-ticker {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

@media (max-width: 576px) {
  .news-ticker {
    font-size: 0.8rem;
    padding: 0.5rem 0;
  }
  .ticker-wrapper {
    gap: 0.5rem;
  }
  .ticker-text {
    animation-duration: 15s;
  }
}

/* Admin panel enhancements */
.admin-sidebar {
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.admin-sidebar h5 {
  margin-bottom: 1rem;
  color: #0d6efd;
  font-weight: 600;
}

.admin-sidebar a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #495057;
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.admin-sidebar a:hover {
  background: #e7f1ff;
  color: #0d6efd;
}

/* Table improvements */
.table-hover tbody tr:hover {
  background-color: #f5f5f5;
}

/* Responsive table wrapper: horizontal scroll on small screens */
.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .table-responsive-wrapper table {
    min-width: 500px;
  }
}

.badge {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
}

/* Card improvements */
.card {
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  margin-bottom: 1.5rem;
}

.card-header {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-weight: 600;
  color: #0d6efd;
}

/* Button improvements */
.btn {
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #0d6efd;
  border-color: #0d6efd;
}

.btn-primary:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.3);
}

/* Form improvements */
.form-control, .form-select {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 576px) {
  .form-control, .form-select {
    font-size: 16px; /* prevents zoom on focus in iOS */
  }
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }
}

.form-control:focus, .form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Responsive improvements */
@media (max-width: 768px) {
  .impact-number {
    font-size: 2rem;
  }

  .timeline {
    margin-left: 0.5rem;
    border-left-width: 2px;
  }

  .timeline li::before {
    left: -5px;
  }

  section.py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .list-group-item {
    padding: 0.75rem 1rem;
  }

  footer .row > div {
    text-align: center;
  }

  footer .list-unstyled {
    display: inline-block;
    text-align: left;
  }
}

@media (max-width: 576px) {
  .impact-number {
    font-size: 1.75rem;
  }

  .testimonial {
    padding: 1rem;
    font-size: 0.95rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-title {
    font-size: 1.1rem;
  }
}

/* Print styles */
@media print {
  .navbar, footer, .btn-group, .admin-menu {
    display: none;
  }
  
  body {
    background: white;
  }
}

/* Form validation styles */
.invalid-feedback {
  display: block;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.invalid-feedback.d-none {
  display: none !important;
}

.form-control:invalid {
  border-color: #dc3545;
}

.form-control:invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Text danger utility extensions */
.text-danger {
  font-size: 0.875rem;
}

/* Form field spacing improvements */
.form-control, .form-select {
  margin-bottom: 0.25rem;
}

.form-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-label .text-danger {
  margin-left: 0.125rem;
}

/* Small helper text styling */
.form-text {
  font-size: 0.875rem;
  color: #6c757d;
  display: block;
  margin-top: 0.25rem;
}
