/* ========================================
   SPIRITUAL SEVA PLATFORM - OPTIMIZED CSS
   Restructured for Better Performance & UX
   ======================================== */

/* ===============================
   1. CSS RESET & CORE VARIABLES
   =============================== */

:root {
  /* Color Palette */
  --primary-gold: #c28800;
  --primary-dark-gold: #a06f00;
  --light-gold: #ffd288;
  --cream-bg: #fffbe6;
  --light-cream: #f9f5e3;
  --white-cream: #fffdf7;
  --text-dark: #5c3d00;
  --text-heading: #5e4204;
  --border-gold: #d9b673;
  --shadow-gold: rgba(194, 136, 0, 0.3);
  
  /* Navigation Colors */
  --nav-dark: #1a1a1a;
  --nav-medium: #2c2c2c;
  --nav-text: #FFD700;
  
  /* Spacing */
  --nav-padding: 15px 18px;
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: inherit;
}

body {
  background: radial-gradient(circle at top left, var(--cream-bg), var(--light-cream));
  font-family: 'Tiro Devanagari Marathi', serif;
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===============================
   2. TYPOGRAPHY SYSTEM
   =============================== */

h1, h2, h3, h4, h5, h6 {
  text-align: center;
  color: var(--text-heading);
  margin-bottom: 20px;
  text-shadow: 0 1px 1px #ffe8b0;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 5vw, 2.5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 1.25rem;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1rem;
  max-width: 65ch;
}

/* ===============================
   3. ANIMATION FRAMEWORK
   =============================== */

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 500px;
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 500px;
  }
  to {
    opacity: 0;
    transform: translateY(-15px);
    max-height: 0;
  }
}

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

.fade-in {
  animation: fadeIn 1.2s ease forwards;
  opacity: 0;
}

.pulse-animation {
  animation: pulse 2s infinite;
}

/* ===============================
   4. ACCESSIBILITY FOUNDATION
   =============================== */

/* Skip Link */
.skip-link {
  position: absolute;
  top: -50px;
  left: 10px;
  background: var(--primary-gold);
  color: white;
  padding: 10px 15px;
  text-decoration: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  z-index: 1003;
  transition: top 0.3s ease;
  font-weight: bold;
}

.skip-link:focus {
  top: 0;
}

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

/* Focus Management */
.focused,
*:focus-visible {
  outline: 2px solid var(--primary-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===============================
   5. LAYOUT SYSTEM
   =============================== */

/* Main Content Container */
.main-content {
  background: radial-gradient(circle at top left, var(--cream-bg), var(--light-cream));
  color: var(--text-dark);
  padding: clamp(15px, 5vw, 30px);
  min-height: calc(100vh - 200px);
}

.content-wrapper {
  background: #ffffff;
  padding: clamp(15px, 4vw, 20px);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  min-height: 400px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Breadcrumb System */
.breadcrumb {
  background: #fff4d4;
  padding: 10px 15px;
  border-radius: 5px;
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.breadcrumb a {
  color: var(--primary-gold);
  text-decoration: none;
  transition: var(--transition);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===============================
   6. HEADER & NAVIGATION SYSTEM
   =============================== */

.site-header {
  background: linear-gradient(135deg, var(--nav-dark) 0%, var(--nav-medium) 100%);
  box-shadow: 0 4px 12px var(--shadow-gold);
  border-bottom: 2px solid var(--primary-gold);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.navbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(15px, 3vw, 30px);
  position: relative;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Site Logo */
.site-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  z-index: 1001;
  text-decoration: none;
  transition: var(--transition);
}

.logo-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--primary-gold);
  box-shadow: 0 2px 8px var(--shadow-gold);
  transition: var(--transition);
}

.logo-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--shadow-gold);
}

/* Navigation Links Structure */
.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-wrap: nowrap;
  gap: 5px;
}

.nav-item {
  position: relative;
  margin: 0;
  flex-shrink: 0;
}

/* Create hover bridge to prevent dropdown closing */
.nav-item::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
  z-index: 1000;
}

.nav-link {
  display: block;
  padding: var(--nav-padding);
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: clamp(12px, 2vw, 14px);
  transition: var(--transition);
  border-radius: 6px;
  white-space: nowrap;
  position: relative;
}

.nav-link:hover {
  color: var(--primary-gold);
  text-shadow: 0 0 5px var(--light-gold);
  background: rgba(194, 136, 0, 0.1);
  transform: translateY(-1px);
}

.nav-link:focus-visible {
  outline: 2px solid var(--primary-gold);
  outline-offset: 2px;
  background: rgba(194, 136, 0, 0.2);
}

/* Special Navigation Highlight */
.highlight-nav {
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px var(--light-gold);
  padding: 10px 16px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 6px rgba(255, 210, 136, 0.25);
  display: inline-block;
}

/* ===============================
   7. ENHANCED DROPDOWN SYSTEM
   =============================== */

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--nav-dark);
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--primary-gold);
  border-radius: var(--border-radius);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-15px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1001;
  overflow: hidden;
  pointer-events: none;
  transition-delay: 0.15s; /* Delay when hiding */
}

/* Enhanced Hover Logic - Prevents Dropdown Disappearing */
.nav-item:hover .dropdown,
.dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s; /* No delay when showing or hovering */
}

/* Keep dropdown open when moving cursor over it */
.dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown.show {
  animation: slideDown 0.3s ease forwards;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.dropdown a {
  display: block;
  padding: 14px 20px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
  border-bottom: 1px solid rgba(194, 136, 0, 0.2);
  position: relative;
}

.dropdown a:last-child {
  border-bottom: none;
}

.dropdown a:hover,
.dropdown a:focus-visible {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-dark-gold));
  color: #fff;
  padding-left: 30px;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  transform: translateX(5px);
}

.dropdown a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* ===============================
   8. MOBILE NAVIGATION SYSTEM
   =============================== */

.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 12px;
  border-radius: 6px;
  transition: var(--transition);
  position: absolute;
  right: clamp(15px, 3vw, 30px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 1002;
}

.hamburger:hover {
  color: var(--primary-gold);
  text-shadow: 0 0 5px var(--light-gold);
}

.hamburger-icon {
  display: block;
  transition: transform 0.3s ease;
  font-size: 24px;
}

.hamburger.active .hamburger-icon {
  transform: rotate(90deg);
}

.nav-links.hidden {
  display: none;
}

/* ===============================
   9. FORM SYSTEM
   =============================== */

.contact-container form,
.dashboard-container {
  max-width: 720px;
  margin: 40px auto;
  background-color: var(--white-cream);
  border: 2px solid #e6cfaa;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(180, 120, 0, 0.15);
  padding: clamp(20px, 5vw, 30px);
}

.otp-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  gap: 10px;
}

.otp-form input[type="text"],
.otp-form input[type="tel"],
input[type="email"],
input[type="password"],
textarea,
select {
  height: 40px;
  max-width: 100%;
  font-size: 14px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background-color: #fdfaf0;
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(200, 160, 80, 0.15);
  transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-gold);
  box-shadow: 0 0 0 2px rgba(194, 136, 0, 0.2);
}

textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
}

/* ===============================
   10. BUTTON SYSTEM
   =============================== */

form button,
.button,
.btn {
  background-color: var(--primary-gold);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(194, 136, 0, 0.2);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  min-width: 120px;
}

form button:hover,
.button:hover,
.btn:hover {
  background-color: var(--primary-dark-gold);
  box-shadow: 0 4px 16px rgba(162, 111, 0, 0.4);
  transform: translateY(-2px);
}

form button:active,
.button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(194, 136, 0, 0.2);
}

form button:focus-visible,
.button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--primary-gold);
  outline-offset: 2px;
}

/* Button Variations */
.btn-secondary {
  background-color: var(--nav-medium);
  color: var(--nav-text);
}

.btn-secondary:hover {
  background-color: #404040;
}

/* ===============================
   11. TABLE SYSTEM
   =============================== */

.table-container {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  min-width: 600px; /* Ensure table doesn't get too cramped */
}

th, td {
  border: 1px solid var(--border-gold);
  padding: 12px;
  text-align: left;
}

th {
  background-color: #fff4d4;
  color: var(--text-dark);
  text-shadow: 0 1px 1px #ffe8b0;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:nth-child(even) {
  background-color: #fdfaf0;
}

tr:hover {
  background-color: #fff4d4;
  transform: scale(1.01);
  transition: var(--transition);
}

td {
  transition: var(--transition);
}

/* ===============================
   12. CONTENT COMPONENTS
   =============================== */

.thought-box,
.wisdom-container,
blockquote {
  background-color: var(--cream-bg);
  border-left: 4px solid var(--primary-gold);
  padding: 20px;
  margin: 30px auto;
  font-size: clamp(16px, 3vw, 18px);
  color: var(--text-dark);
  box-shadow: 0 2px 8px rgba(180, 120, 0, 0.1);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  position: relative;
}

.thought-box::before {
  content: '"';
  font-size: 4rem;
  color: var(--primary-gold);
  position: absolute;
  top: -10px;
  left: 15px;
  opacity: 0.3;
}

/* Video Components */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.video-grid iframe {
  border: 2px solid var(--border-gold);
  border-radius: var(--border-radius);
  box-shadow: 0 0 10px rgba(180, 120, 0, 0.15);
  width: 100%;
  height: 200px;
  transition: var(--transition);
}

.video-grid iframe:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(180, 120, 0, 0.25);
}

.video-container {
  max-width: 960px;
  margin: 0 auto;
  background: #f3efe9;
  padding: clamp(15px, 4vw, 24px);
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0,0,0,0.1);
}

.video-title {
  font-family: 'Mukta', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #5c3d2e;
  text-align: center;
  margin-bottom: 20px;
}

.video-note {
  text-align: center;
  font-style: italic;
  color: #7a5c4b;
  margin-top: 12px;
  font-size: 0.875rem;
}

/* Special Program Components */
.non-clickable-heading {
  background-color: #8A2BE2;
  color: #fff;
  padding: 12px;
  font-weight: 600;
  border-radius: 4px 4px 0 0;
}

.clickable-blue-box {
  background-color: #1E3A8A;
  color: var(--nav-text);
  padding: 12px;
  display: block;
  text-decoration: none;
  transition: var(--transition);
  border-radius: 0 0 4px 4px;
}

.clickable-blue-box:hover {
  background-color: #1E40AF;
  transform: translateX(5px);
}

/* Sadguru Access Component */
.access-granted {
  text-align: center;
  background-color: #fef9f2;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.sadguru-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(200, 160, 80, 0.25);
  object-fit: cover;
  transition: var(--transition);
}

.sadguru-img:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(200, 160, 80, 0.4);
}

.blessing {
  font-size: 1.2em;
  color: var(--text-dark);
  margin: 15px 0 25px;
  font-style: italic;
}

/* ===============================
   13. FOOTER SYSTEM
   =============================== */

.site-footer {
  background: linear-gradient(135deg, var(--nav-dark) 0%, var(--nav-medium) 100%);
  color: var(--nav-text);
  padding: 40px 0 20px;
  margin-top: 50px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(15px, 3vw, 30px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.footer-section h3 {
  color: var(--primary-gold);
  margin-bottom: 15px;
  font-size: 1.2rem;
  text-align: left;
}

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

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section a {
  color: var(--nav-text);
  text-decoration: none;
  transition: var(--transition);
}

.footer-section a:hover {
  color: var(--primary-gold);
  text-decoration: underline;
  transform: translateX(5px);
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid #444;
  margin-top: 30px;
  padding-top: 20px;
  color: #ccc;
  font-size: 0.875rem;
}

/* ===============================
   14. RESPONSIVE BREAKPOINTS
   =============================== */

/* Large Tablets and Small Desktops (1024px and down) */
@media (max-width: 1024px) {
  .nav-link {
    padding: 14px;
    font-size: 13px;
  }

  .dropdown {
    min-width: 250px;
  }

  .navbar {
    padding: 0 20px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* Tablets (768px and down) */
@media (max-width: 768px) {
  .logo-image {
    width: 60px;
    height: 60px;
    border-width: 2px;
  }
  
  .hamburger {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--nav-dark);
    flex-direction: column;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-radius: 0 0 12px 12px;
    border-top: 2px solid var(--primary-gold);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-in-out;
    z-index: 999;
    gap: 0;
  }

  .nav-links:not(.hidden) {
    display: flex;
    max-height: 600px;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid rgba(194, 136, 0, 0.2);
  }

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

  .nav-item::after {
    display: none; /* Remove hover bridge on mobile */
  }

  .nav-link {
    padding: 16px 20px;
    border-radius: 0;
    width: 100%;
    text-align: left;
  }

  .nav-link:hover {
    background: rgba(194, 136, 0, 0.2);
    transform: none;
    padding-left: 25px;
  }

  /* Mobile Dropdown System */
  .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: var(--nav-medium);
    border: none;
    border-radius: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .dropdown.show {
    max-height: 300px;
  }

  .dropdown a {
    padding: 12px 40px;
    font-size: 13px;
    color: var(--nav-text);
    border-bottom: 1px solid rgba(194, 136, 0, 0.1);
  }

  .dropdown a:hover {
    padding-left: 45px;
    background: var(--primary-gold);
    color: #fff;
    transform: none;
  }

  .main-content {
    padding: 20px;
  }

  .content-wrapper {
    padding: 15px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .table-container {
    margin: 10px -15px;
  }
}

/* Mobile Phones (480px and down) */
@media (max-width: 480px) {
  .logo-image {
    width: 50px;
    height: 50px;
    border-width: 2px;
  }
  
  .navbar {
    padding: 0 15px;
  }

  .nav-link {
    font-size: 14px;
    padding: 14px 18px;
  }

  .dropdown a {
    padding: 10px 35px;
    font-size: 13px;
  }

  .dropdown a:hover {
    padding-left: 40px;
  }

  .main-content {
    padding: 15px;
  }

  .contact-container form,
  .dashboard-container {
    padding: 15px;
    margin: 15px auto;
  }

  .video-container {
    padding: 15px;
  }

  .thought-box,
  .wisdom-container,
  blockquote {
    margin: 20px 0;
    padding: 15px;
  }
}

/* ===============================
   15. ADVANCED BROWSER SUPPORT
   =============================== */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .nav-link {
    border: 1px solid transparent;
  }

  .nav-link:hover,
  .nav-link:focus {
    border-color: var(--primary-gold);
    background: #000;
    color: #fff;
  }

  .dropdown {
    border: 2px solid var(--primary-gold);
  }

  .button,
  .btn {
    border: 2px solid var(--primary-gold);
  }
}

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

  .fade-in {
    animation: none;
    opacity: 1;
  }

  .pulse-animation {
    animation: none;
  }
}

/* Dark Mode Support (if implemented) */
@media (prefers-color-scheme: dark) {
  :root {
    --cream-bg: #2a2a2a;
    --light-cream: #333333;
    --text-dark: #e0e0e0;
    --text-heading: #f0f0f0;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .hamburger,
  .nav-links,
  .site-footer {
    display: none;
  }

  .main-content {
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }

  .dropdown {
    display: none;
  }

  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ===============================
   16. UTILITY CLASSES
   =============================== */

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-bold { font-weight: bold; }
.text-italic { font-style: italic; }

/* Spacing Utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem
