/* Toggle Dark Mode Compact - Version déplaçable avec chevron au-dessus */
.theme-toggle-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 9998;
    pointer-events: none;
    transition: transform 0.15s linear;
    will-change: transform;
}

.theme-toggle {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 2px 2px 5px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.05),
        0 0 0 2px rgba(139, 92, 246, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    overflow: visible; /* Changé de hidden à visible pour voir le chevron */
    border: 2px solid rgba(255, 255, 255, 0.9);
    touch-action: none;
    user-select: none;
}

.toggle-icon {
    position: absolute;
    font-size: 22px; /* Légèrement augmenté pour plus de visibilité */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: scale(0);
}

.sun-icon {
    color: #FF9500;
    opacity: 1;
    transform: scale(1);
}

.dark .sun-icon {
    opacity: 0;
    transform: scale(0) rotate(180deg);
}

.moon-icon {
    color: #8B5CF6;
    opacity: 0;
    transform: scale(0) rotate(-180deg);
}

.dark .moon-icon {
    opacity: 1;
    transform: scale(1) rotate(0);
}

/* CHEVRON AU-DESSUS DES ICÔNES */
.mini-icon {
    position: absolute;
    font-size: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

/* Chevron soleil - positionné AU-DESSUS du soleil */
.mini-sun {
    color: #FF9500;
    top: -5px; /* Positionné AU-DESSUS du cercle */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dark .mini-sun {
    opacity: 0;
    transform: translateX(-50%) scale(0);
    top: -10px;
}

/* Chevron lune - positionné AU-DESSUS de la lune */
.mini-moon {
    color: #8B5CF6;
    top: -5px; /* Positionné AU-DESSUS du cercle */
    right: 50%;
    transform: translateX(50%) scale(0);
    opacity: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dark .mini-moon {
    opacity: 0.8;
    transform: translateX(50%) scale(1);
    top: -5px;
}

/* Animation de rotation pour les chevrons */
@keyframes bounce-chevron {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-2px); }
}

.mini-sun {
    animation: bounce-chevron 2s infinite;
}

.dark .mini-moon {
    animation: bounce-chevron 2s infinite;
}

/* Indicateur de drag - positionné en dessous maintenant */
.drag-indicator {
    position: absolute;
    bottom: -25px; /* En dessous du bouton */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(139, 92, 246, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease, bottom 0.2s ease;
    pointer-events: none;
    z-index: 10001;
}

.drag-indicator.show {
    opacity: 1;
    bottom: -30px; /* Légèrement plus bas quand visible */
}

/* Pour le mode sombre */
.theme-toggle.dark .drag-indicator {
    background: rgba(139, 92, 246, 0.8);
    color: #e0e0e0;
}

/* Bouton retour en haut - avec le même style de chevron */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 2px 2px 5px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.9);
    touch-action: none;
    user-select: none;
    overflow: visible;
}

.back-to-top i {
    font-size: 22px;
    color: #333;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Chevron pour le bouton retour en haut */
.back-to-top::before {
    content: '▲';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #3b82f6;
    opacity: 0.8;
    transition: all 0.3s ease;
    z-index: 2;
}

.back-to-top:hover:not(.dragging)::before {
    top: -10px;
    opacity: 1;
    color: #1d4ed8;
}

/* Mode sombre pour le bouton retour en haut */
[data-theme="dark"] .back-to-top {
    background: linear-gradient(145deg, #2a2a3a, #1e1e2e);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .back-to-top i {
    color: #e0e0e0;
}

[data-theme="dark"] .back-to-top::before {
    color: #8b5cf6;
}

/* Ajustements pour le drag */
.theme-toggle:active,
.back-to-top:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.theme-toggle.dragging,
.back-to-top.dragging {
    opacity: 0.9;
    z-index: 10000;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.25),
        0 0 0 4px rgba(139, 92, 246, 0.4);
}

/* Tooltip positionné à gauche pour ne pas gêner */
.theme-toggle::before,
.back-to-top::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10002;
}

.theme-toggle:hover:not(.dragging)::before,
.back-to-top:hover:not(.dragging)::before {
    opacity: 1;
    visibility: visible;
    right: 65px;
}

/* Animation de chargement */
.theme-toggle.loading::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #8B5CF6;
    animation: spin 0.6s linear infinite;
    z-index: 1;
}

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

/* Effet de lueur pour les chevrons */
.mini-sun::before,
.mini-moon::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, currentColor 20%, transparent 70%);
    opacity: 0.2;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
}

/* Responsive */
@media (max-width: 768px) {
    .theme-toggle {
        width: 45px;
        height: 45px;
    }
    
    .toggle-icon {
        font-size: 20px;
    }
    
    .mini-icon {
        font-size: 9px;
        top: -4px;
    }
    
    .mini-sun {
        top: -4px;
    }
    
    .dark .mini-moon {
        top: -4px;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
    }
    
    .back-to-top i {
        font-size: 20px;
    }
    
    .back-to-top::before {
        font-size: 10px;
        top: -6px;
    }
    
    .drag-indicator {
        font-size: 9px;
        padding: 3px 6px;
        bottom: -22px;
    }
    
    .drag-indicator.show {
        bottom: -25px;
    }
    
    /* Cacher tooltip sur mobile */
    .theme-toggle::before,
    .back-to-top::before {
        display: none;
    }
}

/* Mode édition - animation */
.edit-mode .theme-toggle,
.edit-mode .back-to-top {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

/* Pour les écrans très petits */
@media (max-width: 480px) {
    .theme-toggle {
        width: 42px;
        height: 42px;
        bottom: 70px;
        right: 10px;
    }
    
    .toggle-icon {
        font-size: 18px;
    }
    
    .mini-icon {
        font-size: 8px;
        top: -3px;
    }
    
    .back-to-top {
        width: 42px;
        height: 42px;
        bottom: 20px;
        right: 10px;
    }
    
    .back-to-top i {
        font-size: 18px;
    }
    
    .back-to-top::before {
        font-size: 9px;
        top: -5px;
    }
}

/* Effet hover subtil pour les chevrons */
.mini-sun:hover,
.mini-moon:hover {
    transform: translateX(-50%) scale(1.2);
    opacity: 1;
}

.dark .mini-moon:hover {
    transform: translateX(50%) scale(1.2);
}

/* Mode sombre pour le body */
[data-theme="dark"] {
    --bg-color: #0f0f15;
    --text-color: #e0e0e0;
    --card-bg: #1a1a24;
    --border-color: #2a2a3a;
}

[data-theme="dark"] body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

[data-theme="dark"] .carte,
[data-theme="dark"] .product-card,
[data-theme="dark"] .gif-card {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .selection {
    background: #2a2a3a !important;
    color: #e0e0e0;
}

/* Responsive */
@media (max-width: 768px) {
    .theme-toggle {
        width: 45px;
        height: 45px;
        bottom: 80px;
        right: 15px;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 25px;
        right: 15px;
    }
    
    .theme-toggle::before {
        display: none; /* Masquer tooltip sur mobile */
    }
}

/* Empêcher le toggle de bloquer les clics */
.theme-toggle,
.back-to-top {
    pointer-events: auto;
}

/* Pour les écrans très petits */
@media (max-width: 480px) {
    .theme-toggle-container,
    .back-to-top {
        transform: scale(0.9);
    }
    
    .theme-toggle {
        bottom: 70px;
        right: 10px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 10px;
    }
}
/* Styles spécifiques pour le mode sombre */
[data-theme="dark"] .dark-mode-text {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .dark-mode-card {
    background: linear-gradient(145deg, #1a1a24, #2a2a3a) !important;
    border: 1px solid #2a2a3a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .dark-mode-header {
    background: #1a1a24 !important;
    border-bottom: 1px solid #2a2a3a !important;
}

[data-theme="dark"] .dark-mode-footer {
    background: #1a1a24 !important;
    border-top: 1px solid #2a2a3a !important;
}

[data-theme="dark"] .titre,
[data-theme="dark"] .price,
[data-theme="dark"] .old-price,
[data-theme="dark"] .stock,
[data-theme="dark"] .prix,
[data-theme="dark"] .reduit,
[data-theme="dark"] .stock-text {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .category-name {
    color: #b0b0b0 !important;
}

[data-theme="dark"] .left-panel li a,
[data-theme="dark"] .right-panel a {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .left-panel li:hover,
[data-theme="dark"] .right-panel figure:hover {
    background: #2a2a3a !important;
}

/* Ajustements pour les GIFs et images */
[data-theme="dark"] .gif-item {
    filter: brightness(0.9) contrast(1.1);
}

/* Ajustements pour le header flash */
[data-theme="dark"] .flash-header {
    background: #2a2a3a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .flash-title {
    color: #8B5CF6 !important;
}

/* Ajustements pour les boutons */
[data-theme="dark"] .buy-button,
[data-theme="dark"] .add-to-cart,
[data-theme="dark"] .achat {
    background: linear-gradient(145deg, #8B5CF6, #7C3AED) !important;
    color: white !important;
}

[data-theme="dark"] button:not(.theme-toggle):not(.back-to-top) {
    background: #2a2a3a !important;
    color: #e0e0e0 !important;
    border: 1px solid #3a3a4a !important;
}

/* Ajustements pour les liens */
[data-theme="dark"] a:not(.theme-toggle):not(.back-to-top) {
    color: #8B5CF6 !important;
}

[data-theme="dark"] a:hover:not(.theme-toggle):not(.back-to-top) {
    color: #a78bfa !important;
}

/* Ajustements pour le conteneur principal */
[data-theme="dark"] .container_marche {
    background: rgba(26, 26, 36, 0.95) !important;
}

/* Ajustements pour les carousels */
[data-theme="dark"] .carousel-item,
[data-theme="dark"] .carousel_marche {
    border: 2px solid #2a2a3a !important;
}

/* Ajustements pour la bannière d'installation */
[data-theme="dark"] .install-banner {
    background: linear-gradient(135deg, #2a2a3a 0%, #3a3a4a 100%) !important;
    color: #e0e0e0 !important;
    border: 1px solid #3a3a4a !important;
}

[data-theme="dark"] .install-banner button {
    background: #8B5CF6 !important;
    color: white !important;
}