/* Enhanced Modern UI with Professional Design */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #475569;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --background: #ffffff;
  --surface: #f8fafc;
  --surface-elevated: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
  --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --gradient-accent: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Animations */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(30px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes slideIn {
  from { 
    transform: translateX(-30px); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0); 
    opacity: 1; 
  }
}

@keyframes pulse {
  0%, 100% { 
    transform: scale(1); 
  }
  50% { 
    transform: scale(1.05); 
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navigation - Enhanced */
.navbar {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1rem 0;
}

.navbar.navbar-scrolled {
  box-shadow: var(--shadow);
  padding: 0.75rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary);
  transition: all 0.3s ease;
  letter-spacing: -0.02em;
}

.navbar-brand:hover {
  color: var(--primary-dark);
  transform: scale(1.05);
}

/* Navigation Links - Enhanced with underline for active */
.nav-link {
  position: relative;
  font-weight: 500;
  color: var(--text);
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

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

.nav-link:hover::after {
  width: 70%;
}

/* Active nav link - Bold AND underlined */
.nav-link.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-link.active::after {
  width: 80%;
  height: 3px;
}

/* Hero Section - Full Screen with Background Image */
.hero-fullscreen {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--background);
  background-image: url("../img/bgog.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(37, 99, 235, 0.4) 100%
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
  padding: 2rem;
  max-width: 800px;
  animation: fadeInUp 1s ease-out;
}

.hero-title {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
  animation: fadeInUp 1s ease-out 0.2s backwards;
}

.hero-subtitle {
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 2.5rem;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
  line-height: 1.6;
  animation: fadeInUp 1s ease-out 0.4s backwards;
}

.hero-content .btn {
  padding: 1rem 3rem;
  font-size: 1.125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
  animation: fadeInUp 1s ease-out 0.6s backwards;
  transition: all 0.3s ease;
}

/* Primary button (Discover More) - Blue background, white text */
.hero-content .btn-primary {
  background: var(--primary) !important;
  color: white !important;
  border: 3px solid var(--primary);
  position: relative;
  overflow: hidden;
}

.hero-content .btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.hero-content .btn-primary:hover {
  background: var(--primary-dark) !important;
  color: white !important;
  border-color: var(--primary-dark);
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 16px 32px rgba(29, 78, 216, 0.5);
}

.hero-content .btn-primary:hover::before {
  width: 400px;
  height: 400px;
}

.hero-content .btn-primary:active {
  transform: translateY(-2px) scale(1.02);
}

/* Secondary button (Get Updates) - White background, blue text */
.hero-content .btn-light {
  background: white !important;
  color: var(--primary) !important;
  border: 3px solid white;
  position: relative;
  overflow: hidden;
}

.hero-content .btn-light::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.hero-content .btn-light:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--primary-dark) !important;
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 16px 32px rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.95);
}

.hero-content .btn-light:hover::before {
  width: 400px;
  height: 400px;
}

.hero-content .btn-light:active {
  transform: translateY(-2px) scale(1.02);
}

/* Button container for proper spacing */
.hero-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Cards - Enhanced Design */
.card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeIn 0.6s ease-out;
  background: var(--surface-elevated);
  overflow: hidden;
}

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

.card-img-top {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-img-top {
  transform: scale(1.1);
}

/* Buttons - Enhanced */
.btn {
  border-radius: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
  width: 300%;
  height: 300%;
}

.btn-primary {
  background: var(--gradient-primary);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.4);
}

.btn-outline-primary {
  border: 2px solid var(--primary);
  color: var(--primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* Book Cards - Special styling */
.book-card {
  position: relative;
  overflow: hidden;
  height: 100%;
}

.book-card img {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 350px;
  object-fit: cover;
  width: 100%;
}

.book-card:hover img {
  transform: scale(1.08);
}

.book-card .card-body {
  padding: 1.5rem;
}

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

/* Forms - Enhanced */
.form-control {
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  background: var(--surface);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
  background: white;
  outline: none;
}

.form-select {
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
  outline: none;
}

/* Modal animations */
.modal.fade .modal-dialog {
  transform: scale(0.9) translateY(-50px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-content {
  border-radius: 1rem;
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
}

/* Section titles - CENTERED with float-up animation */
.section-title {
  position: relative;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-title.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80px;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

.section-title.animate-in::after {
  transform: translateX(-50%) scaleX(1);
}

/* Sections spacing */
section {
  padding: 4rem 0;
  animation: fadeIn 0.8s ease-out;
}

/* Remove any default scroll-margin that might interfere */
section[id] {
  scroll-margin-top: 0;
}

/* Ensure sections don't have extra padding causing offset issues */
section {
  position: relative;
}

/* Video cards */
.ratio {
  border-radius: 0.75rem;
  overflow: hidden;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  animation: slideInFromBottom 0.5s ease-out;
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
}

.back-to-top:active {
  transform: translateY(-2px) scale(1.05);
}

/* Footer - Enhanced */
.footer {
  background: linear-gradient(to bottom, var(--surface) 0%, #e2e8f0 100%);
  padding: 4rem 0 2rem;
  margin-top: 6rem;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
  font-weight: 500;
}

.footer a:hover {
  color: var(--primary);
}

/* Alert styles */
.alert {
  border-radius: 0.75rem;
  border: none;
  animation: slideIn 0.5s ease-out;
}

.alert-success {
  background: rgba(22,163,74,0.1);
  color: var(--success);
  border-left: 4px solid var(--success);
}

/* Utility classes */
.text-muted {
  color: var(--text-muted) !important;
}

/* Mobile Responsive - Enhanced */
@media (max-width: 768px) {
  .hero-fullscreen {
    min-height: 100vh;
    background-attachment: scroll;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.125rem;
    margin-bottom: 2rem;
  }
  
  .hero-content .btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
  }
  
  /* Mobile button layout - stacked and centered */
  .hero-buttons {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .hero-content .btn {
    width: 100%;
    max-width: 320px;
    margin: 0;
  }
  
  .navbar {
    padding: 0.75rem 0;
  }
  
  .section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    padding-top: 0.5rem;
  }
  
  section {
    padding: 3rem 0;
  }
  
  .card {
    margin-bottom: 1.5rem;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Mobile menu styling */
  .navbar-collapse {
    background: var(--surface-elevated);
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
  }
  
  .nav-link {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin: 0.25rem 0;
  }
  
  .nav-link:hover {
    background: var(--surface);
  }
  
  .nav-link.active {
    background: rgba(37,99,235,0.1);
  }
  
  .nav-link::after {
    display: none;
  }
  
  /* Show underline differently on mobile */
  .nav-link.active {
    border-left: 4px solid var(--primary);
  }
  
  /* Back to top button mobile adjustments */
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.25rem;
  }
  
  /* FIX: Prevent stuck hover/focus states on mobile nav links */
  .nav-link:focus,
  .nav-link.focus {
    outline: none;
    background: transparent !important;
  }
  
  /* Remove any persistent hover effects on touch devices */
  .nav-link:active {
    background: var(--surface) !important;
  }
  
  /* Clear hover state immediately after touch */
  @media (hover: none) {
    .nav-link:hover {
      background: transparent !important;
    }
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.375rem;
  }
  
  .container {
    max-width: 960px;
  }
}

/* Loading animation for images */
img {
  transition: opacity 0.3s ease;
}

img:not([src]) {
  opacity: 0;
}

/* Smooth transitions for all interactive elements */
a, button, input, select, textarea {
  transition: all 0.3s ease;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus, .btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.3);
}

/* Remove focus outline from nav links after click */
.nav-link:focus {
  outline: none;
}

.nav-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}