/**
 * CSS Christmas Light Bulb Markers
 * Modern, animated markers for SparkleTour map
 * Replaces PNG bulb images with pure CSS
 */

/* Base CSS Bulb Marker */
.css-bulb-marker {
    background: transparent !important;
    border: none !important;
}

/* Tour Marker Icons - Numbered circles for addresses in tour */
.tour-marker-icon {
    background: transparent !important;
    border: none !important;
}

.tour-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.tour-marker:hover {
    transform: scale(1.1);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Regular address in tour - red fill with white outline */
.tour-marker-regular {
    background: linear-gradient(135deg, #e53935 0%, #c41e3a 100%);
    border-color: white;
}

/* Best Of address in tour - gold background */
.tour-marker-bestof {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.css-bulb {
    width: 12px;
    height: 20px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: relative;
    animation: bulb-glow 2s ease-in-out infinite;
    transition: transform 0.2s ease;
    
    /* Black border around the bulb */
    border: 1px solid #2c2c2c;
    
    /* Glass-like appearance with depth */
    background-image:
        /* Top highlight (glass reflection) */
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        /* Bottom shadow (depth) */
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%);
    
    /* Enhanced shadows for realism */
    box-shadow:
        /* Inner shadow for depth */
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

/* Glass shine effect */
.css-bulb::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 35%;
    height: 35%;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.5) 40%,
        transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Metallic screw base with threading detail */
.css-bulb::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 2px;
    width: 8px;
    height: 6px;
    background:
        /* Threading lines */
        repeating-linear-gradient(
            180deg,
            #C0C0C0 0px,
            #A0A0A0 1px,
            #808080 2px,
            #A0A0A0 3px
        );
    border-radius: 2px;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Glow animation */
@keyframes bulb-glow {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        opacity: 0.7;
        filter: brightness(1.2);
    }
}

/* Marker highlight animation for deep linking */
@keyframes markerPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 215, 0, 0));
  }
  50% {
    transform: scale(1.3);
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
  }
}

.marker-highlight {
  animation: markerPulse 1s ease-in-out 2;
  z-index: 10000 !important;
}

/* Mobile-optimized marker sizes for better touch targets */
@media (max-width: 768px) {
  .css-bulb {
    width: 16px;
    height: 26px;
  }
  
  .css-bulb::after {
    bottom: -8px;
    left: 3px;
    width: 10px;
    height: 8px;
  }
}

/* Extra small screens - even larger for easier tapping */
@media (max-width: 576px) {
  .css-bulb {
    width: 18px;
    height: 30px;
  }
  
  .css-bulb::after {
    bottom: -9px;
    left: 3.5px;
    width: 11px;
    height: 9px;
  }
}

/* Ensure marker with open popup has highest z-index */
.leaflet-marker-icon.leaflet-interactive {
  z-index: 1000;
}

/* Marker with open popup gets even higher z-index */
.leaflet-marker-pane .leaflet-marker-icon[style*="z-index: 1000"] {
  z-index: 1600 !important;
}

/* Color Variations - Realistic C9 bulb colors with enhanced depth */
.css-bulb-amber {
    background-color: #FFB347;
    background-image:
        /* Glass highlights (inherited from .css-bulb) */
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        /* Color gradient */
        linear-gradient(135deg, #FFB347 0%, #FF8C00 100%);
    box-shadow:
        0 0 12px rgba(255, 179, 71, 0.9),
        0 0 24px rgba(255, 140, 0, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

.css-bulb-blue {
    background-color: #4444FF;
    background-image:
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        linear-gradient(135deg, #4444FF 0%, #0000CC 100%);
    box-shadow:
        0 0 12px rgba(68, 68, 255, 0.9),
        0 0 24px rgba(0, 0, 204, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

.css-bulb-green {
    background-color: #44FF44;
    background-image:
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        linear-gradient(135deg, #44FF44 0%, #00CC00 100%);
    box-shadow:
        0 0 12px rgba(68, 255, 68, 0.9),
        0 0 24px rgba(0, 204, 0, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

.css-bulb-pink {
    background-color: #FF69B4;
    background-image:
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        linear-gradient(135deg, #FF69B4 0%, #FF1493 100%);
    box-shadow:
        0 0 12px rgba(255, 105, 180, 0.9),
        0 0 24px rgba(255, 20, 147, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

.css-bulb-purple {
    background-color: #CC44FF;
    background-image:
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        linear-gradient(135deg, #CC44FF 0%, #8800CC 100%);
    box-shadow:
        0 0 12px rgba(204, 68, 255, 0.9),
        0 0 24px rgba(136, 0, 204, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

.css-bulb-teal {
    background-color: #00CED1;
    background-image:
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        linear-gradient(135deg, #00CED1 0%, #008B8B 100%);
    box-shadow:
        0 0 12px rgba(0, 206, 209, 0.9),
        0 0 24px rgba(0, 139, 139, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

.css-bulb-yellow {
    background-color: #FFD700;
    background-image:
        radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.3) 30%,
            transparent 60%),
        radial-gradient(ellipse at 50% 90%,
            rgba(0, 0, 0, 0.3) 0%,
            transparent 50%),
        linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow:
        0 0 12px rgba(255, 215, 0, 0.9),
        0 0 24px rgba(255, 165, 0, 0.6),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

/* Best Of marker - Elaborate 5-pointed golden star with dark border */
.css-bulb-bestof {
    width: 36px;
    height: 36px;
    position: relative;
    animation: bestof-pulse 2s ease-in-out infinite;
    
    /* Override base .css-bulb styles */
    background: transparent !important;
    background-image: none !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Dark border star (larger, behind the gold star) */
.css-bulb-bestof::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    
    /* Create 5-pointed star shape */
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
    
    /* Dark border color */
    background: #2c2c2c;
    
    /* Shadow for depth */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Main golden star (on top of border) */
.css-bulb-bestof::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    transform: translate(-50%, -50%);
    z-index: 1;
    
    /* Create 5-pointed star shape */
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
    
    /* Metallic gold gradient with depth */
    background:
        linear-gradient(135deg,
            #FFD700 0%,
            #FFC700 15%,
            #FFE55C 30%,
            #FFED4E 45%,
            #FFD700 60%,
            #DAA520 75%,
            #B8860B 90%,
            #FFD700 100%
        );
    
    /* Inner shadows only for 3D depth - no outer glow */
    box-shadow:
        inset -2px -2px 4px rgba(184, 134, 11, 0.6),
        inset 2px 2px 4px rgba(255, 237, 78, 0.8);
}


/* Enhanced pulse animation with rotation and glow */
@keyframes bestof-pulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1) drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }
    25% {
        transform: scale(1.15) rotate(5deg);
        filter: brightness(1.2) drop-shadow(0 0 15px rgba(255, 215, 0, 0.9));
    }
    50% {
        transform: scale(1.1) rotate(0deg);
        filter: brightness(1.3) drop-shadow(0 0 20px rgba(255, 215, 0, 1));
    }
    75% {
        transform: scale(1.15) rotate(-5deg);
        filter: brightness(1.2) drop-shadow(0 0 15px rgba(255, 215, 0, 0.9));
    }
}

/* Add sparkle effect on hover */
.leaflet-marker-icon.css-bulb-marker:hover .css-bulb-bestof::before {
    animation: star-sparkle 0.6s ease-in-out;
}

@keyframes star-sparkle {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    }
    50% {
        filter: brightness(1.5) drop-shadow(0 0 25px rgba(255, 215, 0, 1));
    }
}

/* Ensure markers are clickable */
.leaflet-marker-icon.css-bulb-marker {
    cursor: pointer;
}

/* Adjust marker cluster styles to work with CSS bulbs */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(255, 215, 0, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(255, 215, 0, 0.8);
    color: #1a1a1a;
    font-weight: bold;
}
/* Ensure the indicator is positioned relative to the marker */
.css-bulb-marker {
    position: relative;
}
