/* Global Styles for B M Upadhyay Shiksha Samiti */

/* Custom Properties */
:root {
  --primary-color: #478ac9;
  --secondary-color: #f5d654;
  --accent-color: #2563eb;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

/* Browser compatibility enhancements */
:root {
  --theme-color: #478ac9;
  --moz-theme-color: #478ac9; /* Firefox fallback */
  --webkit-theme-color: #478ac9; /* Safari fallback */
  --ms-theme-color: #478ac9; /* Edge/IE fallback */
  --opera-theme-color: #478ac9; /* Opera fallback */
}

/* Advanced browser-specific CSS variables for theme color support */
html {
  /* CSS Custom Properties for browsers that don't support meta theme-color */
  --browser-theme-fallback: #478ac9;
  --mobile-browser-theme: #478ac9;
}

/* Enhanced browser compatibility using feature detection */
@supports not (color: color(display-p3 1 0 0)) {
  /* Fallback for browsers without advanced color support */
  :root {
    --enhanced-theme-color: #478ac9;
  }
}

/* Safari-specific theme color enhancements */
@supports (-webkit-appearance: none) {
  html {
    --webkit-theme-color-fallback: #478ac9;
  }
  
  /* Enhanced Safari mobile support */
  @media (max-width: 768px) {
    body {
      background-attachment: scroll; /* Fix for Safari mobile */
    }
  }
}

/* Enhanced mobile browser support */
@media (max-width: 768px) {
  html {
    /* Mobile-specific theme color fallback */
    --mobile-theme-primary: #478ac9;
    --mobile-theme-secondary: #f5d654;
  }
  
  /* Status bar styling for mobile browsers */
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background-color: var(--theme-color);
    z-index: 9999;
    pointer-events: none;
  }
}

/* Cross-browser compatibility fixes */
/* IE11 support */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .card, .course-card, .stat-card {
    display: block; /* IE11 grid fallback */
  }
}

/* Browser-specific classes for enhanced targeting */
.browser-firefox .hero,
.browser-opera .hero {
  /* Enhanced background for browsers without theme-color support */
  background: linear-gradient(135deg, #1e3a8a 0%, var(--primary-color) 100%), var(--primary-color);
}

.browser-firefox .navbar,
.browser-opera .navbar {
  /* Add subtle theme color hint to navigation */
  border-top: 2px solid var(--primary-color);
}

/* Mobile browser enhancements */
.is-mobile.browser-firefox body::before,
.is-mobile.browser-opera body::before {
  /* Simulated status bar theme color for unsupported browsers */
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 20px);
  background-color: var(--primary-color);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* CSS Variables fallback for older browsers */
.no-css-vars {
  /* Fallback colors when CSS variables aren't supported */
  --primary-color: #478ac9;
  --secondary-color: #f5d654;
  --accent-color: #2563eb;
}

.no-css-vars .btn-primary {
  background-color: #478ac9;
}

.no-css-vars .btn-secondary {
  background-color: #f5d654;
}

/* CSS Grid fallbacks */
.no-css-grid .course-grid {
  display: flex;
  flex-wrap: wrap;
}

.no-css-grid .stats-grid {
  display: flex;
  flex-wrap: wrap;
}

.no-css-grid .footer-grid {
  display: flex;
  flex-wrap: wrap;
}

/* Backdrop filter fallbacks */
.no-backdrop-filter .course-btn {
  background: rgba(255, 255, 255, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.no-backdrop-filter .feature-card {
  background: rgba(255, 255, 255, 0.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Theme color overlay for unsupported browsers */
.theme-color-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  background: linear-gradient(to bottom, var(--primary-color), transparent);
  z-index: 9999;
  pointer-events: none;
  transition: height 0.3s ease, opacity 0.3s ease;
}

/* Universal font smoothing for all browsers */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: #f9fafb;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-color);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: #3b7fb8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(71, 138, 201, 0.3);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background-color: #f4d03f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 214, 84, 0.3);
}

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

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

/* Cards */
.card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
}

/* Sections */
section {
  padding: 4rem 0;
}

.section-padding {
  padding: 5rem 0;
}

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

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

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-menu li a {
  font-weight: 500;
  color: var(--text-dark);
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav-menu li a:hover,
.nav-menu li a.active {
  color: var(--primary-color);
}

.nav-menu li a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
  border-radius: 1px;
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dark);
  cursor: pointer;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, var(--primary-color) 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

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

.hero .container {
  position: relative;
  z-index: 2;
}

.hero-content {
  text-align: center;
  max-width: 4xl;
  margin: 0 auto;
}

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

.hero-divider {
  width: 6rem;
  height: 4px;
  background-color: var(--secondary-color);
  margin: 2rem auto;
  border-radius: 2px;
}

/* Course Buttons in Hero */
.course-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.course-btn {
  background: rgba(255, 255, 255, 0.2);
  /* Fallback for browsers without backdrop-filter support */
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

/* Apply backdrop-filter only if supported */
@supports (backdrop-filter: blur(10px)) {
  .course-btn {
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.course-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.admission-btn {
  background: var(--secondary-color);
  color: var(--text-dark);
  border: none;
}

.admission-btn:hover {
  background: #f4d03f;
  color: var(--text-dark);
}

/* Feature Cards */
.feature-card {
  text-align: center;
  padding: 2rem;
  /* Fallback for browsers without backdrop-filter support */
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

/* Apply backdrop-filter only if supported */
@supports (backdrop-filter: blur(10px)) {
  .feature-card {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.feature-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
}

.feature-card i {
  font-size: 3rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

.feature-card h3 {
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.9);
}

/* Course Grid */
.course-grid {
  /* Flexbox fallback for browsers without CSS Grid support */
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.course-grid > * {
  /* Flexbox fallback - approximate grid behavior */
  flex: 1 1 250px;
  min-width: 250px;
}

/* CSS Grid for modern browsers */
@supports (display: grid) {
  .course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
  }
  
  .course-grid > * {
    flex: none;
    min-width: auto;
  }
}

.course-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.course-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

.course-card i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.course-card h3 {
  color: var(--text-dark);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Statistics Section */
.stats-grid {
  /* Flexbox fallback for browsers without CSS Grid support */
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.stats-grid > * {
  /* Flexbox fallback - approximate grid behavior */
  flex: 1 1 200px;
  min-width: 200px;
}

/* CSS Grid for modern browsers */
@supports (display: grid) {
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
  }
  
  .stats-grid > * {
    flex: none;
    min-width: auto;
  }
}

.stat-card {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.stat-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  display: block;
}

.stat-label {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.stat-description {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Footer */
footer {
  background: #1f2937;
  color: white;
}

.footer-grid {
  /* Flexbox fallback for browsers without CSS Grid support */
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-grid > * {
  /* Flexbox fallback - approximate grid behavior */
  flex: 1 1 250px;
  min-width: 250px;
}

/* CSS Grid for modern browsers */
@supports (display: grid) {
  .footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
  }
  
  .footer-grid > * {
    flex: none;
    min-width: auto;
  }
}

.footer-section h3 {
  color: white;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: #9ca3af;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: white;
}

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

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

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

/* Animations */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fade-in 0.6s ease forwards;
}

.animate-scale-in {
  animation: scale-in 0.6s ease forwards;
}

.animate-fade-in-up {
  animation: fade-in-up 0.8s ease forwards;
}

.animate-fade-in-left {
  animation: fade-in-left 0.8s ease forwards;
}

.animate-fade-in-right {
  animation: fade-in-right 0.8s ease forwards;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .nav-menu {
    display: none;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .mobile-menu.show {
    display: flex;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  h3 {
    font-size: 1.5rem;
  }
  
  .course-buttons {
    max-width: 100%;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .stat-number {
    font-size: 2.5rem;
  }
}

@media (max-width: 576px) {
  section {
    padding: 2rem 0;
  }
  
  .section-padding {
    padding: 3rem 0;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .course-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(71, 138, 201, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* Map Styles */
.map-container {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Course Detail Styles */
.course-detail-card {
  background: white;
  border-radius: 2rem;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.course-detail-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.course-detail-card.primary {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.course-detail-card.success {
  border-color: var(--success-color);
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.course-detail-card.warning {
  border-color: var(--warning-color);
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

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

.breadcrumb span {
  color: var(--text-light);
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0066cc;
    --text-light: #333333;
  }
  
  .card {
    border: 2px solid #333333;
  }
}

/* Map iframe styles */
.map-iframe {
  border: 0;
  border-radius: 1rem;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
