/* ============================================
   PREMIUM.CSS - Apple/SaaS Style Enhancements
   Magnetic buttons, 3D tilt, gradient borders, etc.
   ============================================ */

/* ============================================
   1) MAGNETIC BUTTON BASE STYLES
   ============================================ */

.btn-magnetic {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
  position: relative;
  overflow: hidden;
}

.btn-magnetic::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
    rgba(255, 255, 255, 0.15) 0%, 
    transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn-magnetic:hover::before {
  opacity: 1;
}

/* Disable magnetic effect on touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn-magnetic {
    transform: none !important;
  }
}

/* ============================================
   2) 3D TILT CARDS WITH GLASS HIGHLIGHT
   ============================================ */

.card-tilt {
  transform-style: preserve-3d;
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  will-change: transform;
}

.card-tilt::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

.card-tilt:hover::after {
  opacity: 1;
}

.card-tilt-content {
  position: relative;
  z-index: 2;
}

/* Glass reflection highlight (follows cursor) */
.card-tilt .glass-highlight {
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
  mix-blend-mode: overlay;
  filter: blur(30px);
}

.card-tilt:hover .glass-highlight {
  opacity: 1;
}

/* Disable tilt on mobile */
@media (max-width: 968px) {
  .card-tilt {
    transform: none !important;
  }
  
  .glass-highlight {
    display: none;
  }
}

/* ============================================
   3) ANIMATED GRADIENT BORDERS
   ============================================ */

.gradient-border {
  position: relative;
  border-radius: var(--radius-lg);
  background: white;
  overflow: hidden;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(
    45deg,
    var(--primary),
    var(--accent),
    #667eea,
    var(--primary)
  );
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderRotate 4s ease infinite;
  pointer-events: none;
  opacity: 0.8;
}

@keyframes gradientBorderRotate {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Pulsing gradient border variant */
.gradient-border-pulse::before {
  animation: gradientBorderRotate 4s ease infinite, borderPulse 2s ease-in-out infinite;
}

@keyframes borderPulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* Static gradient border (no animation) */
.gradient-border-static::before {
  animation: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 1;
}

/* ============================================
   4) SCROLL PROGRESS BAR
   ============================================ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scroll-progress.visible {
  opacity: 1;
}

.scroll-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  width: 0%;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(45, 134, 89, 0.5);
}

/* ============================================
   5) BACK TO TOP BUTTON
   ============================================ */

.back-to-top {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 24px rgba(45, 134, 89, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9997;
  opacity: 0;
  transform: scale(0) translateY(20px);
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 12px 32px rgba(45, 134, 89, 0.4);
}

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

.back-to-top:focus {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }
}

/* ============================================
   6) PREMIUM TOAST NOTIFICATION SYSTEM
   ============================================ */

.toast-container {
  position: fixed;
  top: 90px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: white;
  color: var(--text-dark);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(400px);
  animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--primary);
}

.toast.removing {
  animation: toastSlideOut 0.3s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(400px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(400px);
  }
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  animation: toastIconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastIconPop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
  color: var(--dark);
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-dark);
}

/* Toast variants */
.toast.success {
  border-left-color: #10b981;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast.info {
  border-left-color: #3b82f6;
}

@media (max-width: 768px) {
  .toast-container {
    top: 70px;
    right: 15px;
    left: 15px;
  }
  
  .toast {
    min-width: auto;
    max-width: 100%;
  }
}

/* ============================================
   7) SECTION DIVIDERS & PREMIUM BACKGROUNDS
   ============================================ */

.section-divider {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(45, 134, 89, 0.3) 50%, 
    transparent 100%);
  margin: 4rem 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}

.section-divider::before {
  left: 0;
}

.section-divider::after {
  right: 0;
}

/* Dotted pattern divider */
.section-divider-dots {
  text-align: center;
  margin: 3rem 0;
  opacity: 0.4;
}

.section-divider-dots::before {
  content: '• • •';
  color: var(--primary);
  font-size: 1.5rem;
  letter-spacing: 1rem;
}

/* Noise overlay (subtle texture) */
.noise-overlay {
  position: relative;
}

.noise-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.5;
}

/* Spotlight background effect */
.spotlight-bg {
  position: relative;
  overflow: hidden;
}

.spotlight-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(45, 134, 89, 0.08) 0%, transparent 70%);
  top: -300px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  transition: transform 0.6s ease;
}

/* ============================================
   8) IMPROVED TYPOGRAPHY SYSTEM
   ============================================ */

.text-premium {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.7;
  letter-spacing: -0.01em;
}

.heading-premium {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.subheading-premium {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   9) ICON MICRO-ANIMATIONS
   ============================================ */

.icon-hover {
  display: inline-flex;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-hover:hover {
  transform: scale(1.08);
  filter: brightness(1.1);
}

@keyframes iconBounce {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.15) rotate(-5deg);
  }
  50% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(1.15) rotate(5deg);
  }
}

.icon-rotate:hover {
  animation: iconRotate 0.6s ease;
}

@keyframes iconRotate {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-10deg);
  }
  75% {
    transform: rotate(10deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

.icon-pulse {
  animation: iconPulse 2s ease-in-out infinite;
}

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

/* ============================================
   10) ENHANCED FOCUS STATES
   ============================================ */

.btn:focus-visible,
.whatsapp-btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.star:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   11) GLASS MORPHISM ENHANCEMENTS
   ============================================ */

.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.glass-card-dark {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

/* ============================================
   12) PREMIUM SHIMMER EFFECT (Loading state)
   ============================================ */

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    transparent 100%);
  transform: translateX(-100%);
  animation: shimmerSlide 2s ease-in-out infinite;
}

@keyframes shimmerSlide {
  to {
    transform: translateX(100%);
  }
}

/* ============================================
   13) BADGE ENHANCEMENTS
   ============================================ */

.badge-premium {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
  animation: badgeGlow 2s ease-in-out infinite;
}

@keyframes badgeGlow {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(45, 134, 89, 0.5);
  }
}

/* ============================================
   14) RESPONSIVE SPACING SYSTEM
   ============================================ */

.spacing-premium {
  padding: clamp(2rem, 5vw, 5rem) 0;
}

.container-premium {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 3rem);
}

/* ============================================
   15) ACCESSIBILITY - REDUCED MOTION
   ============================================ */

@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;
  }
  
  .card-tilt,
  .btn-magnetic,
  .icon-hover {
    transform: none !important;
  }
  
  .gradient-border::before {
    animation: none !important;
  }
  
  .glass-highlight {
    display: none !important;
  }
}

/* ============================================
   16) PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Only apply will-change when needed */
.animating {
  will-change: transform, opacity;
}

/* Remove will-change after animation */
.animation-complete {
  will-change: auto;
}

/* GPU acceleration hints */
.gpu-accelerate {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}
