/* ========================================
   TRIVARTA TECH - Custom Styles
   ======================================== */

/* CSS Variables */
:root {
  --primary: #FF3B30;
  --primary-hover: #D32F2F;
  --bg: #0F0F0F;
  --surface: #1A1A1A;
  --surface-hl: #262626;
  --text-primary: #FFFFFF;
  --text-secondary: #A3A3A3;
  --text-tertiary: #6B6B6B;
  --border: #333333;
  --whatsapp: #25D366;
  --gradient: linear-gradient(135deg, #FF3B30 0%, #FF9500 100%);
}

/* Base Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text-secondary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

::selection { background: rgba(255, 59, 48, 0.3); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== SCROLL PROGRESS BAR ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient);
  z-index: 100;
  transition: width 0.1s linear;
}

/* ===== NAVBAR ===== */
#navbar {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.navbar-scrolled {
  background: rgba(15, 15, 15, 0.92) !important;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.nav-link {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.3s ease;
  position: relative;
  padding: 0.25rem 0;
  font-family: 'Outfit', sans-serif;
}
.nav-link:hover, .nav-link.active { color: #FFFFFF; }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gradient);
  border-radius: 1px;
}
.dropdown-menu { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.btn-primary:hover::after { opacity: 1; }
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(255, 59, 48, 0.35);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-secondary {
  background: transparent;
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}
.btn-secondary:active { transform: translateY(0); }

.btn-whatsapp {
  background: var(--whatsapp);
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  position: relative;
  overflow: hidden;
}
.btn-whatsapp::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.btn-whatsapp:hover::after { opacity: 1; }
.btn-whatsapp:hover {
  background: #1DA851;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(37, 211, 102, 0.35);
}
.btn-whatsapp:active { transform: translateY(0) scale(0.98); }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.card::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 59, 48, 0.06) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.card:hover {
  border-color: rgba(255, 59, 48, 0.3);
  transform: translateY(-6px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}
.card:hover::before { transform: scaleX(1); }
.card:hover::after { opacity: 1; }

/* Icon Box */
.icon-box {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.12) 0%, rgba(255, 149, 0, 0.08) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s ease;
  flex-shrink: 0;
}
.card:hover .icon-box {
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.22) 0%, rgba(255, 149, 0, 0.15) 100%);
  transform: scale(1.08) rotate(-3deg);
}

/* ===== HERO SECTIONS ===== */
.hero-bg {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}
.hero-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 59, 48, 0.12) 0%, transparent 70%);
  top: -150px;
  right: -150px;
  animation: heroFloat 10s ease-in-out infinite;
  pointer-events: none;
}
.hero-bg::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 149, 0, 0.08) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: heroFloat 12s ease-in-out infinite reverse;
  pointer-events: none;
}

.hero-mini {
  position: relative;
  overflow: hidden;
  padding-top: 7rem;
  padding-bottom: 4rem;
}
.hero-mini::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 59, 48, 0.1) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  pointer-events: none;
}

.mesh-bg {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* ===== WHATSAPP FLOAT ===== */
.whatsapp-float {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3.5rem;
  height: 3.5rem;
  background: var(--whatsapp);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  animation: pulseWa 2s infinite;
}
.whatsapp-float:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.55);
}
.whatsapp-float:active { transform: scale(0.95); }

/* Tooltip for WhatsApp */
.whatsapp-float::before {
  content: 'Chat with us';
  position: absolute;
  right: 110%;
  top: 50%;
  transform: translateY(-50%);
  background: #1A1A1A;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  border: 1px solid #333;
}
.whatsapp-float:hover::before { opacity: 1; }

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 59, 48, 0.3);
}
.back-to-top:active { transform: translateY(0) scale(0.92); }

/* ===== PAGE LOAD ANIMATION ===== */
.page-loaded body { animation: none; }
body {
  animation: pageIn 0.5s ease-out forwards;
}
@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== TYPING CURSOR ===== */
.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--primary);
  margin-left: 4px;
  animation: blink 0.8s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== ENHANCED MOBILE MENU ===== */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
}
#mobile-menu.menu-open {
  max-height: 600px;
  opacity: 1;
}
/* Override hidden class behavior when animated */
#mobile-menu.hidden { max-height: 0; opacity: 0; }

/* ===== NUMBER HIGHLIGHT ===== */
.stat-number {
  position: relative;
  display: inline-block;
}
.stat-number::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gradient);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.5s ease;
}
.stat-number.counted::after { transform: scaleX(1); }

/* ===== GRADIENT TEXT ===== */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-line {
  width: 48px;
  height: 3px;
  background: var(--gradient);
  border-radius: 2px;
}

/* ===== MODULE GRID ===== */
.module-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  transition: all 0.35s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.module-item:hover {
  border-color: rgba(255, 59, 48, 0.35);
  background: var(--surface-hl);
  transform: translateX(4px);
}
.module-item:active { transform: translateX(2px) scale(0.99); }
.module-item .module-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.12) 0%, rgba(255, 149, 0, 0.08) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== LEARNING CYCLE ===== */
.cycle-container { position: relative; width: 380px; height: 380px; margin: 0 auto; }
.cycle-ring {
  position: absolute;
  inset: 30px;
  border: 2px dashed rgba(255, 59, 48, 0.2);
  border-radius: 50%;
  animation: spinSlow 40s linear infinite;
}
.cycle-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: var(--surface);
  border: 2px solid rgba(255, 59, 48, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.cycle-node {
  position: absolute;
  width: 88px;
  height: 88px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.35s ease;
  z-index: 3;
  cursor: default;
}
.cycle-node:hover {
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(255, 59, 48, 0.25);
}
.cycle-node i { color: var(--primary); font-size: 1.1rem; margin-bottom: 4px; }
.cycle-node span { color: #fff; font-size: 0.7rem; font-weight: 600; font-family: 'Syne', sans-serif; }

.cycle-node:nth-child(3) { top: -10px; left: 50%; transform: translateX(-50%); }
.cycle-node:nth-child(4) { top: 28%; right: -10px; }
.cycle-node:nth-child(5) { bottom: 5%; right: 12%; }
.cycle-node:nth-child(6) { bottom: 5%; left: 12%; }
.cycle-node:nth-child(7) { top: 28%; left: -10px; }

/* ===== STAKEHOLDER CARD ===== */
.stakeholder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.35s ease;
}
.stakeholder-card:hover {
  border-color: rgba(255, 59, 48, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}
.stakeholder-card:active { transform: translateY(-2px) scale(0.98); }
.stakeholder-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.75rem;
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.15) 0%, rgba(255, 149, 0, 0.1) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s ease;
}
.stakeholder-card:hover .stakeholder-icon { transform: scale(1.1) rotate(-5deg); }

/* ===== CTA SECTION ===== */
.cta-gradient {
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.08) 0%, rgba(255, 149, 0, 0.05) 100%);
  border: 1px solid rgba(255, 59, 48, 0.15);
  border-radius: 1.5rem;
  position: relative;
  overflow: hidden;
}
.cta-gradient::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 59, 48, 0.08) 0%, transparent 70%);
  top: -150px;
  right: -150px;
  animation: heroFloat 8s ease-in-out infinite;
  pointer-events: none;
}

/* ===== FOOTER ===== */
footer a:hover { color: var(--primary) !important; }

/* ===== ANIMATIONS ===== */
@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.05); }
  66% { transform: translate(-10px, 15px) scale(0.98); }
}
@keyframes pulseWa {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.anim-fadeInUp {
  animation: fadeInUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}
.anim-delay-1 { animation-delay: 0.15s; }
.anim-delay-2 { animation-delay: 0.3s; }
.anim-delay-3 { animation-delay: 0.45s; }
.anim-delay-4 { animation-delay: 0.6s; }

.anim-float { animation: float 4s ease-in-out infinite; }
.anim-float-delayed { animation: float 4s ease-in-out infinite 1s; }
.anim-float-slow { animation: float 6s ease-in-out infinite 0.5s; }

/* Shimmer border */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer-border { position: relative; }
.shimmer-border::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 59, 48, 0.3), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* Tilt card effect */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 800px;
}

/* ========================================
   MOBILE-FIRST RESPONSIVE
   ======================================== */

/* Small devices */
@media (max-width: 640px) {
  /* Navbar */
  #navbar .h-20 { height: 4rem; }

  /* Hero */
  .hero-bg { min-height: auto; }
  .hero-bg::before { width: 300px; height: 300px; top: -100px; right: -100px; }
  .hero-bg::after { width: 250px; height: 250px; bottom: -100px; left: -100px; }
  .hero-mini { padding-top: 5.5rem; padding-bottom: 2.5rem; }

  /* Buttons full width on mobile */
  .btn-primary, .btn-secondary, .btn-whatsapp {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
  }

  /* Cards */
  .card { padding: 1.5rem; border-radius: 1rem; }
  .card:hover { transform: translateY(-3px); }
  .icon-box { width: 48px; height: 48px; border-radius: 12px; }

  /* Stakeholder cards */
  .stakeholder-card { padding: 1.25rem; }
  .stakeholder-icon { width: 56px; height: 56px; }

  /* Module items */
  .module-item { padding: 1rem 1.25rem; }
  .module-item .module-icon { width: 36px; height: 36px; }

  /* CTA */
  .cta-gradient { border-radius: 1rem; }

  /* Learning Cycle */
  .cycle-container { width: 280px; height: 280px; }
  .cycle-node { width: 66px; height: 66px; }
  .cycle-node span { font-size: 0.55rem; }
  .cycle-node i { font-size: 0.85rem; }
  .cycle-center { width: 65px; height: 65px; }

  /* WhatsApp float */
  .whatsapp-float { bottom: 1rem; right: 1rem; width: 3rem; height: 3rem; }
  .whatsapp-float i { font-size: 1.25rem; }
  .whatsapp-float::before { display: none; }

  /* Back to top */
  .back-to-top { bottom: 1rem; left: 1rem; width: 2.5rem; height: 2.5rem; }

  /* Footer */
  footer { padding-top: 2.5rem !important; }
}

/* Medium devices */
@media (max-width: 768px) {
  .hero-mini { padding-top: 6rem; padding-bottom: 3rem; }
}

/* Touch-friendly improvements */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
  .card:active {
    transform: scale(0.98);
    border-color: rgba(255, 59, 48, 0.3);
  }
  .card:active::before { transform: scaleX(1); }
  .stakeholder-card:hover { transform: none; }
  .stakeholder-card:active { transform: scale(0.97); }
  .module-item:hover { transform: none; }
  .module-item:active { transform: scale(0.98); background: var(--surface-hl); }
  .btn-primary:hover, .btn-whatsapp:hover, .btn-secondary:hover { transform: none; }
  .btn-primary:active, .btn-whatsapp:active { transform: scale(0.96); }
  .btn-secondary:active { transform: scale(0.96); }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-bg { min-height: auto; padding-top: 5rem; padding-bottom: 2rem; }
}

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