/* ==========================================================================
   Millets Technology & Innovation Portal - Premium Hybrid Design System
   Harmonized with Rajalakshmi Engineering College (Purple & Gold)
   and Sustainable Agriculture (Forest Green & Cream)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@600;700&family=Outfit:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,500;0,600;0,700;0,800;1,500;1,600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --color-bg: #fbfbf9;
  --color-card-bg: #ffffff;
  
  /* REC Brand Colors */
  --color-rec-purple: #4c1076;
  --color-rec-purple-dark: #350854;
  --color-rec-purple-light: #f5edfc;
  --color-rec-gold: #f59e0b;
  --color-rec-gold-light: #fef3c7;
  
  /* Heritage Agri Green */
  --color-forest-dark: #123824;
  --color-forest-deep: #0a2416;
  --color-green-primary: #195b36;
  --color-green-hover: #124528;
  --color-green-light: #eef6f0;
  
  --color-text-main: #1e1b24;
  --color-text-muted: #565063;
  --color-border: #e8e4ee;
  
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-script: 'Caveat', cursive;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  
  --shadow-sm: 0 2px 10px rgba(76, 16, 118, 0.04);
  --shadow-md: 0 12px 32px rgba(76, 16, 118, 0.08);
  --shadow-lg: 0 20px 48px rgba(76, 16, 118, 0.12);
  --radius-card: 24px;
  --radius-pill: 9999px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

.font-serif {
  font-family: var(--font-serif);
}

.font-script {
  font-family: var(--font-script);
}

.font-heading {
  font-family: var(--font-heading);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 9px;
}
::-webkit-scrollbar-track {
  background: #f4eff8;
}
::-webkit-scrollbar-thumb {
  background: #5b148c;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b0764;
}

/* Header & Glassmorphism */
.navbar-glass {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 218, 235, 0.8);
  transition: all 0.3s ease;
}

.nav-link {
  font-family: var(--font-sans);
  font-weight: 600;
  color: #3b3547;
  transition: all 0.2s ease;
  position: relative;
  font-size: 0.81rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
@media (min-width: 1536px) {
  .nav-link {
    font-size: 0.86rem;
  }
}
.nav-link:hover, .nav-link.active {
  color: var(--color-rec-purple);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 6px;
  right: 6px;
  height: 2.5px;
  background: linear-gradient(90deg, var(--color-rec-purple), var(--color-rec-gold));
  border-radius: 2px;
}

/* Compact Navbar CTA Button (Ensures Zero Overflow on Any Screen) */
.navbar-cta-btn {
  background: linear-gradient(135deg, #4c1076 0%, #2f084d 100%);
  color: #ffffff !important;
  font-weight: 600;
  padding: 0.45rem 1rem !important;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 12px rgba(76, 16, 118, 0.22);
  transition: all 0.25s ease;
  text-decoration: none;
  border: 1px solid rgba(251, 191, 36, 0.35);
  font-size: 0.78rem;
  white-space: nowrap;
}
.navbar-cta-btn:hover {
  background: linear-gradient(135deg, #5e1492 0%, #3d0a63 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(76, 16, 118, 0.32);
  color: #ffffff !important;
}

/* Primary REC-Purple & Gold Accent Button */
.btn-primary-rec {
  background: linear-gradient(135deg, #4c1076 0%, #2f084d 100%);
  color: #ffffff;
  font-weight: 600;
  padding: 0.78rem 1.7rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(76, 16, 118, 0.28);
  transition: all 0.25s ease;
  text-decoration: none;
  border: 1px solid rgba(251, 191, 36, 0.3);
}
.btn-primary-rec:hover {
  background: linear-gradient(135deg, #5e1492 0%, #3d0a63 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(76, 16, 118, 0.38);
  color: #ffffff;
  border-color: rgba(251, 191, 36, 0.6);
}

.btn-primary-green {
  background-color: var(--color-forest-dark);
  color: #ffffff;
  font-weight: 600;
  padding: 0.78rem 1.7rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(18, 56, 36, 0.22);
  transition: all 0.25s ease;
  text-decoration: none;
}
.btn-primary-green:hover {
  background-color: var(--color-green-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(18, 56, 36, 0.3);
  color: #ffffff;
}

.btn-outline-rec {
  background-color: #ffffff;
  color: var(--color-rec-purple);
  border: 1.5px solid #d4c5e3;
  font-weight: 600;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
  text-decoration: none;
}
.btn-outline-rec:hover {
  border-color: var(--color-rec-purple);
  background-color: #faf5ff;
}

/* Category Cards */
.cat-card {
  background: #ffffff;
  border-radius: var(--radius-card);
  padding: 1.25rem;
  border: 1px solid #ebe5f2;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.cat-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: #c4b0db;
}

.cat-card-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background-color: #f8f6fb;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cat-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.cat-card:hover .cat-card-img-wrap img {
  transform: scale(1.06);
}

.circle-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f5edfc;
  color: var(--color-rec-purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5d3f5;
}

/* Floating Badges */
.floating-badge {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(76, 16, 118, 0.12);
  padding: 0.75rem 1.15rem;
}

/* Deep Majestic Bottom Bar */
.stats-banner-dark {
  background: radial-gradient(circle at 15% 30%, rgba(88, 28, 135, 0.4) 0%, transparent 60%),
              radial-gradient(circle at 85% 70%, rgba(22, 101, 52, 0.35) 0%, transparent 60%),
              #170624;
  color: #ffffff;
}

/* Keyframe Animations */
@keyframes floatGentle {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-9px);
  }
}

@keyframes floatReverse {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(7px);
  }
}

@keyframes shimmerGlow {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes pulseRing {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(76, 16, 118, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(76, 16, 118, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(76, 16, 118, 0);
  }
}

@keyframes pulseGold {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
  }
}

@keyframes shineEffect {
  0% {
    left: -100%;
  }
  20% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

.animate-float-slow {
  animation: floatGentle 4.5s ease-in-out infinite;
}

.animate-float-reverse {
  animation: floatReverse 5s ease-in-out infinite;
}

.animate-pulse-ring {
  animation: pulseRing 2.5s infinite;
}

.animate-pulse-gold {
  animation: pulseGold 2.2s infinite;
}

/* Scroll Progress Indicator Bar */
#scrollProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #4c1076 0%, #f59e0b 50%, #195b36 100%);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* Card Hover Elevation */
.card-interactive {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}
.card-interactive:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px -8px rgba(76, 16, 118, 0.14), 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Shimmer on Button Hover */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}
.btn-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    60deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 80%
  );
  transform: rotate(25deg);
  transition: all 0.75s ease;
}
.btn-shimmer:hover::after {
  left: 140%;
}

/* Back to Top Button */
#backToTopBtn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#backToTopBtn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#backToTopBtn:hover {
  transform: translateY(-4px) scale(1.05);
}

/* Modal Animation */
.tech-modal-overlay {
  background-color: rgba(26, 8, 44, 0.75);
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease;
}

#techDetailModal > div,
#galleryLightbox > div {
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ==========================================================================
   3D Rotating Gallery Carousel (Inspire from Reference)
   ========================================================================== */
.scene {
  width: 100%;
  height: 220px;
  perspective: 1600px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin: 15px auto;
}
.carousel-3d {
  width: 220px;
  height: 155px;
  position: relative;
  transform-style: preserve-3d;
  animation: rotateGallery 32s infinite linear;
}
.carousel-3d:hover {
  animation-play-state: paused;
}
.panel-3d {
  position: absolute;
  width: 220px;
  height: 155px;
  left: 0;
  top: 0;
  background: #ffffff;
  border: 2px solid var(--color-rec-purple);
  border-radius: 12px;
  box-sizing: border-box;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 25px rgba(76, 16, 118, 0.18);
  backface-visibility: hidden;
  transition: transform 0.3s ease;
}
.panel-3d:hover {
  border-color: #f59e0b;
}
.panel-3d h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 2px 0 4px 0;
  color: var(--color-rec-purple);
  text-transform: uppercase;
  width: 100%;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 3px;
  font-family: var(--font-heading);
}
.panel-3d img {
  width: 100%;
  height: 105px;
  object-fit: cover;
  border-radius: 8px;
}
.panel-3d:nth-child(1) { transform: rotateY(0deg) translateZ(280px); }
.panel-3d:nth-child(2) { transform: rotateY(45deg) translateZ(280px); }
.panel-3d:nth-child(3) { transform: rotateY(90deg) translateZ(280px); }
.panel-3d:nth-child(4) { transform: rotateY(135deg) translateZ(280px); }
.panel-3d:nth-child(5) { transform: rotateY(180deg) translateZ(280px); }
.panel-3d:nth-child(6) { transform: rotateY(225deg) translateZ(280px); }
.panel-3d:nth-child(7) { transform: rotateY(270deg) translateZ(280px); }
.panel-3d:nth-child(8) { transform: rotateY(315deg) translateZ(280px); }

@keyframes rotateGallery {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-360deg); }
}

/* ==========================================================================
   Bespoke Tamil Nadu Millet Agro-Climatic Living Atlas (Unique Scientific Architecture)
   ========================================================================== */
.atlas-shell {
  background: #ffffff;
  border: 1px solid rgba(76, 16, 118, 0.12);
  border-radius: 2rem;
  box-shadow: 0 20px 45px -10px rgba(76, 16, 118, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  position: relative;
}

.atlas-hud-bar {
  background: linear-gradient(135deg, #1f0733 0%, #300a50 50%, #170526 100%);
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.atlas-map-stage {
  position: relative;
  width: 100%;
  height: 520px;
  background: #f4efe6;
  overflow: hidden;
}

@media (min-width: 768px) {
  .atlas-map-stage {
    height: 580px;
  }
}

#tnMap, #tnMapHome {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Custom Cartographic Filter for Luxury Map Tone */
.atlas-map-stage .leaflet-tile-pane {
  filter: contrast(1.05) saturate(1.1) brightness(0.98);
}

/* Radar Pulse Marker Nodes */
.atlas-radar-marker {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.atlas-radar-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border: 2px solid #ffffff;
  position: relative;
  z-index: 2;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.atlas-radar-marker:hover .atlas-radar-core,
.atlas-radar-marker.active .atlas-radar-core {
  transform: scale(1.22);
  border-color: #fbbf24;
}

.atlas-radar-wave {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  opacity: 0.6;
  animation: radarWavePulse 2.4s infinite ease-out;
  pointer-events: none;
  z-index: 1;
}

@keyframes radarWavePulse {
  0% {
    width: 24px;
    height: 24px;
    opacity: 0.8;
  }
  100% {
    width: 58px;
    height: 58px;
    opacity: 0;
  }
}

.atlas-radar-badge {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 7, 51, 0.92);
  backdrop-filter: blur(4px);
  color: #fef3c7;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(245, 158, 11, 0.4);
  pointer-events: none;
  letter-spacing: 0.3px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.atlas-radar-marker:hover .atlas-radar-badge,
.atlas-radar-marker.active .atlas-radar-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.leaflet-tooltip.atlas-tooltip {
  background: rgba(31, 7, 51, 0.95) !important;
  backdrop-filter: blur(8px) !important;
  color: #fef3c7 !important;
  border: 1px solid rgba(245, 158, 11, 0.5) !important;
  border-radius: 8px !important;
  font-family: "Outfit", sans-serif !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
  letter-spacing: 0.3px !important;
}

.leaflet-tooltip-top.atlas-tooltip:before {
  border-top-color: rgba(31, 7, 51, 0.95) !important;
}

/* Floating District Intelligence Dossier */
.atlas-dossier-panel {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  padding: 1.4rem;
  border-radius: 1.5rem;
  box-shadow: 0 20px 40px -10px rgba(31, 7, 51, 0.28), 0 0 0 1px rgba(76, 16, 118, 0.15);
  z-index: 999;
  display: none;
  animation: atlasDossierSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.atlas-dossier-panel.visible {
  display: block;
}

@keyframes atlasDossierSlide {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.atlas-dossier-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f5f5f4;
  color: #78716c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.atlas-dossier-close:hover {
  background: #4c1076;
  color: #ffffff;
}

/* Zone Filter Buttons */
.atlas-filter-pill {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.2s ease;
  border: 1px solid rgba(76, 16, 118, 0.15);
  background: #ffffff;
  color: #44403c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.atlas-filter-pill:hover {
  background: #faf5ff;
  border-color: #4c1076;
  color: #4c1076;
}

.atlas-filter-pill.active {
  background: linear-gradient(135deg, #4c1076 0%, #300a50 100%);
  color: #ffffff;
  border-color: #4c1076;
  box-shadow: 0 4px 12px rgba(76, 16, 118, 0.25);
}

.atlas-filter-pill.active .badge-count {
  background: #f59e0b;
  color: #1f0733;
}

.atlas-filter-pill .badge-count {
  background: #f5f5f4;
  color: #78716c;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 800;
}

/* Horizontal District Cards Strip */
.atlas-cards-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .atlas-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .atlas-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.atlas-district-card {
  background: #ffffff;
  border: 1px solid rgba(76, 16, 118, 0.1);
  border-radius: 1.25rem;
  padding: 1.15rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.atlas-district-card:hover {
  border-color: #4c1076;
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -6px rgba(76, 16, 118, 0.12);
}

.atlas-district-card.active {
  border-color: #4c1076;
  background: linear-gradient(to bottom right, #faf5ff 0%, #ffffff 100%);
  box-shadow: 0 0 0 2px #4c1076, 0 12px 24px -6px rgba(76, 16, 118, 0.15);
}

