html {
  font-size: 14px;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Enhanced focus states for accessibility */
.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #2c3e50;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f8f9fa;
}

main {
  flex: 1;
}

/* Flatly theme enhancements */
.footer {
  background: linear-gradient(to right, #ecf0f1, #f8f9fa);
}

/* Card hover effects for learning content */
.card {
  transition: all 0.3s ease;
  border: none;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1.5rem rgba(44, 62, 80, 0.15) !important;
}

/* Badge styling for categories */
.badge {
  font-weight: 500;
  transition: all 0.2s ease;
}

.badge:hover {
  transform: scale(1.05);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* Alert styling for educational tips - Enhanced for Flatly theme */
.alert {
  border: 2px solid;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.alert-info {
  background-color: #d9edf7;
  border-color: #3498db;
  color: #1d4e6e;
}

.alert-info strong {
  color: #2c3e50;
}

.alert-info a {
  color: #2980b9;
  font-weight: 600;
  text-decoration: underline;
}

.alert-info a:hover {
  color: #1f5f8b;
  text-decoration: none;
}

.alert-info code {
  background-color: rgba(52, 152, 219, 0.15);
  color: #2c3e50;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.9em;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

/* Navigation enhancements */
.navbar-brand {
  font-size: 1.5rem;
  transition: transform 0.2s ease;
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.nav-link {
  transition: all 0.2s ease;
  border-radius: 0.25rem;
  margin: 0 0.25rem;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Form styling improvements */
.form-floating > .form-control-plaintext::placeholder, 
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, 
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.form-control,
.form-select {
  border-radius: 0.5rem;
  border: 2px solid #ecf0f1;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #2c3e50;
  box-shadow: 0 0 0 0.25rem rgba(44, 62, 80, 0.1);
}

/* Button enhancements */
.btn {
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  box-shadow: 0 0.125rem 0.25rem rgba(44, 62, 80, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(44, 62, 80, 0.3);
  transform: translateY(-2px);
}

/* Learning-focused styles */
.display-4 {
  color: #2c3e50;
  font-weight: 700;
}

h1, h2, h3, h4, h5, h6 {
  color: #2c3e50;
  font-weight: 600;
}

/* Image grid enhancements */
.card-img-top {
  border-radius: 0.5rem 0.5rem 0 0;
}

/* Loading states */
img[loading="lazy"] {
  background: linear-gradient(90deg, #ecf0f1 25%, #f8f9fa 50%, #ecf0f1 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Responsive utilities */
@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .display-4 {
    font-size: 2.5rem;
  }
}

/* Accessibility improvements */
a:focus-visible,
button:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .navbar,
  .footer {
    display: none;
  }
}