/**
 * WINE WORLD MAP - STYLES V8.1
 * Correction : animation pointillés (.rotating-path), fill:none, z-index
 */

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.wine-map-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
    overflow: visible;
}

.wine-map-container {
    position: relative;
    width: 100%;
    padding-top: 50%;
    background: transparent;
}

.map-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    z-index: 2;
}

/* ============================================
   ANIMATION DES POINTILLÉS SVG
   En dessous de la carte (z-index: 1)
   ============================================ */
.dotted-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible; /* ← AJOUT : autorise les paths à déborder */
}
.rotating-path {
    fill: none;
    stroke: #e33033;
    stroke-width: 2.5px;
    stroke-linecap: round;
    stroke-dasharray: 6 8;
    stroke-dashoffset: 0;
    will-change: stroke-dashoffset;
    
    /* iOS Safari : force le rendu GPU */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    
    /* Préfixe webkit obligatoire pour iOS < 16 */
    -webkit-animation: dash-flow 6s linear infinite;
    animation: dash-flow 6s linear infinite !important;
}

.rotating-path.fast {
    -webkit-animation-duration: 3s;
    animation-duration: 3s !important;
}

.rotating-path.slow {
    -webkit-animation-duration: 10s;
    animation-duration: 10s !important;
}

/* Paths sans dasharray (cls-1 dans le SVG original) : trait continu animé */
.rotating-path:not([stroke-dasharray]) {
    stroke-dasharray: 4 6;
    opacity: 0.6;
}
@-webkit-keyframes dash-flow {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -200; }
}

@keyframes dash-flow {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -200; }
}

/* Classe legacy conservée pour compatibilité */
.animated-dash {
    fill: none;
    stroke: #e33033;
    stroke-width: 2.5px;
    stroke-linecap: round;
    animation: dash-flow 25s linear infinite;
}

/* ============================================
   CONTAINER DES ANIMAUX
   ============================================ */
.animals-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

/* ============================================
   MARKERS ANIMAUX
   ============================================ */
.animal-marker {
    position: absolute;
    cursor: pointer;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.animal-marker.fade-in {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.animal-marker:hover {
    transform: translate(-50%, -50%) scale(1.08);
    z-index: 50;
}

.animal-marker.active {
    z-index: 9999 !important;
}

/* ============================================
   IMAGE DE L'ANIMAL
   ============================================ */
.animal-image {
    width: 120px;
    height: 120px;
    position: relative;
    transition: all 0.3s ease;
}

.animal-marker:hover .animal-image {
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.animal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ============================================
   MARQUEUR MOBILE
   ============================================ */
@media (max-width: 768px) {
    .animal-image img {
        display: none;
    }

    .animal-image::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 16px;
        height: 16px;
        background: #e33033;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(227, 48, 51, 0.6);
    }

    .animal-image::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 16px;
        height: 16px;
        background: rgba(227, 48, 51, 0.4);
        border-radius: 50%;
        animation: mobile-pulse 2s ease-out infinite;
    }

    @keyframes mobile-pulse {
        0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
        100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
    }
}

/* ============================================
   TOOLTIP
   ============================================ */
.wine-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: #e33033;
    border-radius: 0;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    width: 260px;
    z-index: 100000;
    display: flex;
    overflow: hidden;
}

.animal-marker.active .wine-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* ============================================
   LAYOUT TOOLTIP
   ============================================ */
.tooltip-image-container {
    flex-shrink: 0;
    width: 80px;
    background: rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.tooltip-main-image {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
}

.tooltip-content {
    flex: 1;
    padding: 12px 14px;
    color: white;
    display: flex;
    flex-direction: column;
    max-height: 180px;
}

/* ============================================
   HEADER - DRAPEAU IMAGE
   ============================================ */
.tooltip-header {
    background: transparent;
    padding: 0;
    margin-bottom: 10px;
    flex-shrink: 0;
    line-height: 1;
}

.tooltip-header .country-flag-img {
    height: 22px;
    width: auto;
    display: block;
}

.tooltip-header .country-flag {
    font-size: 2.2em;
    line-height: 1;
    display: block;
}

.tooltip-header .country-name {
    font-size: 0.9em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
}

.tooltip-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    color: white;
    font-size: 18px;
    line-height: 20px;
    text-align: center;
    opacity: 0.7;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.15);
    border: none;
    padding: 0;
    border-radius: 0;
    z-index: 10;
}

.tooltip-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.3);
}

/* ============================================
   LISTE DES VINS
   ============================================ */
.wines-list {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.wines-list::-webkit-scrollbar { width: 4px; }
.wines-list::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.08); }
.wines-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 2px;
}

.wine-item {
    display: block;
    padding: 7px 10px;
    background: rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
    text-decoration: none;
    color: white;
    font-size: 0.85em;
    border-left: 2px solid transparent;
}

.wine-item:hover {
    background: rgba(0, 0, 0, 0.22);
    transform: translateX(4px);
    border-left-color: white;
}

.wine-name {
    font-weight: 600;
    color: white;
    display: block;
    line-height: 1.3;
}

.wine-type {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    display: block;
    margin-top: 2px;
}

a.wine-item::after {
    content: '→';
    float: right;
    color: white;
    font-weight: bold;
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.2s;
}

a.wine-item:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .animal-image { transform: scale(0.85); }
    .wine-tooltip { width: 245px; }
    .tooltip-image-container { width: 72px; }
}

@media (max-width: 1024px) {
    .animal-image { transform: scale(0.75); }
    .wine-tooltip { width: 230px; }
    .tooltip-image-container { width: 68px; }
    .tooltip-content { padding: 10px 12px; }
    .tooltip-header .country-flag-img { height: 24px; }
}

@media (max-width: 768px) {
    .wine-map-container { padding-top: 100%; }
    .animal-image {
        transform: none;
        width: 24px;
        height: 24px;
    }
    .wine-tooltip {
        width: 90vw;
        max-width: 300px;
    }
    .tooltip-image-container { width: 75px; }
    .wines-list { max-height: 140px; }
    .tooltip-header .country-flag-img { height: 22px; }

    /* Pointillés simplifiés sur mobile */
    .rotating-path {
        stroke-width: 1.5px;
        animation-duration: 8s;
    }
}

@media (max-width: 480px) {
    .wine-tooltip {
        width: 94vw;
        max-width: 280px;
    }
    .tooltip-image-container { width: 70px; }
    .wine-item { padding: 6px 8px; font-size: 0.8em; }
}

/* ============================================
   LOADING
   ============================================ */
.wine-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2em;
    z-index: 100;
}

.wine-map-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media print {
    .wine-tooltip,
    .dotted-animation { display: none !important; }
}
