/* Custom CSS for Sophia Entreprises */

/* Floating animation for elements */
.floating {
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* Shine effect for buttons and cards */
.shine-effect {
  position: relative;
  overflow: hidden;
}

.shine-effect::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  animation: shine 6s infinite linear;
  pointer-events: none;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(30deg); }
  100% { transform: translateX(100%) rotate(30deg); }
}

/* Hover effect for cards */
.card-hover {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* Custom marker pulse effect */
.marker-pulse {
  position: relative;
  transition: all 0.3s ease;
}

/* Base state - no glow */
.marker-pulse:not(.hovered):not(.clicked):not(.favorite-marker) {
  box-shadow: none;
}

/* Hovered state - black neon */
.marker-pulse.hovered:not(.clicked):not(.favorite-marker) {
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.7),
              0 0 15px 5px rgba(0, 0, 0, 0.3);
}

/* Clicked/Selected state - white neon (higher specificity) */
.marker-pulse.clicked:not(.favorite-marker) {
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.8),
              0 0 15px 5px rgba(255, 255, 255, 0.4) !important;
}

/* Favorite state - gold neon */
.marker-pulse.favorite-marker {
  box-shadow: 0 0 10px 2px rgba(255, 215, 0, 0.7),
              0 0 15px 5px rgba(255, 215, 0, 0.3);
}

/* Ensure favorite state always takes precedence */
.marker-pulse.favorite-marker.hovered,
.marker-pulse.favorite-marker.clicked {
  box-shadow: 0 0 10px 2px rgba(255, 215, 0, 0.7),
              0 0 15px 5px rgba(255, 215, 0, 0.3);
}

/* Custom scrollbar for the entire page */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.8);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 10px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.7);
}

/* Focus styles */
.focus-effect:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.3);
  transform: scale(1.02);
}

/* Gradient text effect */
.gradient-text {
  background: linear-gradient(90deg, #0071e3, #00a3ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  animation: gradient-text 4s linear infinite;
}

@keyframes gradient-text {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Background pattern */
.bg-pattern {
  background-color: #f8fafc;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e2e8f0' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Custom badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
  font-weight: 500;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
  border-radius: 10rem;
  transition: all 0.2s ease;
}

.badge:hover {
  transform: scale(1.05);
}

/* Scale in effect for new elements */
.scale-in {
  animation: scale-in 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  transform-origin: center bottom;
}

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

/* Loading spinner with gradient */
.spinner-gradient {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #0071e3, #00a3ff, #0071e3);
  animation: spinner 1s linear infinite;
}

.spinner-gradient::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  background: white;
  border-radius: 50%;
}

@keyframes spinner {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Custom tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 120px;
  background-color: rgba(17, 24, 39, 0.9);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.75rem;
}

.tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(17, 24, 39, 0.9) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* 3D card effect */
.card-3d {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
}

.card-3d:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(5deg) scale3d(1.02, 1.02, 1.02);
}

/* Shimmer loading effect */
.shimmer {
  position: relative;
  background: #f6f7f8;
  background-image: linear-gradient(
    to right, 
    #f6f7f8 0%, 
    #edeef1 20%, 
    #f6f7f8 40%, 
    #f6f7f8 100%
  );
  background-size: 800px 104px;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% {
    background-position: -468px 0;
  }
  100% {
    background-position: 468px 0;
  }
}

/* Typewriter effect for headings */
.typewriter {
  overflow: hidden;
  border-right: .15em solid #0071e3;
  white-space: nowrap;
  margin: 0 auto;
  letter-spacing: .15em;
  animation: 
    typing 3.5s steps(40, end),
    blink-caret .75s step-end infinite;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: #0071e3 }
}

/* Custom selection color */
::selection {
  background-color: rgba(0, 113, 227, 0.2);
  color: #0071e3;
}

/* Flip card effect */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 0.5rem;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* Pagination styles */
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  margin: 0 2px;
  border-radius: 6px;
  background-color: white;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pagination-btn:hover:not([disabled]) {
  background-color: #f8fafc;
  color: #0071e3;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination-btn:active:not([disabled]) {
  transform: translateY(0);
}

.pagination-btn.active {
  background-color: #0071e3;
  color: white;
  border-color: #0071e3;
}

.pagination-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom marker cluster styles */
.marker-cluster-custom {
  background-color: transparent !important;
  background: none !important;
}

.marker-cluster-custom div {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marker-cluster-custom:hover div {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Clicked card styles */
.clicked-card {
  transform: translateY(-4px) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
  border-color: #0071e3 !important;
}

/* Optimize animations for low-end devices */
@media (prefers-reduced-motion: reduce) {
  .floating, .scale-in, .shine-effect::after, .pulse-effect, 
  .card-hover:hover, .marker-pulse::after, .gradient-text {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
  
  .card-hover:hover, .pagination-btn:hover:not([disabled]) {
    transform: none !important;
  }
}

/* Performance optimizations */
img, iframe, video {
  loading: lazy;
}

/* Minimize paint and layout operations */
.reduce-paint {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Optimize for render performance */
.company-card, .pagination-btn, .marker-pulse, .modal-content {
  will-change: transform;
}

/* Optimize animations */
@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;
  }
}

/* Optimize rendering of marker clusters with large datasets */
.leaflet-marker-icon, .leaflet-marker-shadow {
  will-change: transform;
}

.leaflet-container {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* Reduce visual complexity on mobile or low-performance devices */
@media (max-width: 768px), (prefers-reduced-motion: reduce) {
  .marker-pulse::after {
    display: none;
  }
  
  .shine-effect::after {
    display: none;
  }
  
  .floating {
    animation: none;
  }
}

/* Global loading screen styles */
#global-loading {
    background: linear-gradient(135deg, #f5f7ff 0%, #f0f4ff 40%, #ebf1ff 60%, #e6eeff 100%);
}

#global-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/cubes.png');
    opacity: 0.2;
    z-index: -1;
}

/* Optimize animations */
@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;
    }
} 