/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== LOADING SYSTEM ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(30, 60, 114, 0.95) 0%, rgba(42, 82, 152, 0.95) 50%, rgba(102, 126, 234, 0.95) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-container {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 2rem;
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #fff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

/* Spinner moderne */
.modern-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.spinner-ring {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    position: absolute;
    top: 0;
    left: 0;
    border-top-color: #60a5fa;
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 44px;
    height: 44px;
    border-top-color: #a78bfa;
    animation-duration: 2s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Barre de progression */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Dots animés */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Messages de chargement */
.loading-message {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 1rem;
    min-height: 1.2rem;
    animation: messageFade 2s ease-in-out infinite;
}

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

/* Variantes de loading */
.loading-compact {
    padding: 1rem;
}

.loading-compact .loading-logo {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.loading-compact .loading-title {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.loading-compact .loading-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.loading-compact .modern-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
}

.loading-compact .spinner-ring:nth-child(3) {
    top: 6px;
    left: 6px;
    width: 28px;
    height: 28px;
}

/* Loading pour les boutons */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading pour les sections */
.section-loading {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.8);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
}

.section-loading .modern-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
}

.section-loading .loading-message {
    position: absolute;
    bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    /* Support pour iOS safe-area */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    /* Support pour Android */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    /* Empêcher le zoom sur double-tap */
    touch-action: pan-x pan-y;
}

/* Mode API - Vue plein écran */
body.api-mode {
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body.api-mode #app {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    margin: 0;
    padding: 0;
    flex-direction: column;
}

body.api-mode .app-header {
    display: none !important;
}

body.api-mode .sidebar {
    display: none !important;
}

body.api-mode .app-main {
    height: 100vh;
    width: 100vw;
    flex: 1;
    margin: 0;
    padding: 0;
    display: flex;
    overflow: hidden;
}

body.api-mode {
    /* Support pour iOS safe-area */
    padding: 0 !important;
    margin: 0 !important;
    /* Utiliser env() pour les safe areas iOS */
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

body.api-mode .scene-container {
    margin: 0 !important;
    border-radius: 0 !important;
    /* Utiliser calc() avec safe-area pour iOS */
    height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
    flex: 1;
    min-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    position: relative;
    /* Support pour Android */
    -webkit-overflow-scrolling: touch;
}

body.api-mode #scene3d {
    height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
    min-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
}

body.api-mode #notifications {
    display: none !important;
}

/* Overlay API Mode */
.api-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}

.api-logo-container {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1001;
    pointer-events: none;
}

.api-logo {
    max-width: 150px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.api-location-name {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 1001;
    pointer-events: none;
    background: linear-gradient(135deg, 
        rgba(33, 150, 243, 0.98) 0%, 
        rgba(25, 118, 210, 0.98) 30%,
        rgba(13, 71, 161, 0.98) 70%,
        rgba(25, 118, 210, 0.98) 100%);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    padding: 1rem 2.5rem;
    border-radius: 20px;
    box-shadow: 
        0 16px 48px rgba(33, 150, 243, 0.45),
        0 8px 24px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    border: 2.5px solid rgba(255, 255, 255, 0.6);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: labelSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    /* Centrage parfait */
    margin: 0 auto;
    text-align: center;
}

.api-location-name::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) rotate(180deg);
        opacity: 0.3;
    }
}

@keyframes labelSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.85);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0);
    }
}

.api-location-name span {
    color: white;
    font-size: 1.35rem;
    font-weight: 900;
    text-shadow: 
        0 3px 6px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(255, 255, 255, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
    white-space: nowrap;
    display: inline-block;
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(255, 255, 255, 1) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Responsive pour l'overlay API - Tablettes et petits écrans */
@media (max-width: 768px) {
    .api-logo {
        max-width: 120px;
        max-height: 70px;
        padding: 0.6rem;
        border-radius: 14px;
        box-shadow: 
            0 8px 24px rgba(0, 0, 0, 0.2),
            0 4px 12px rgba(0, 0, 0, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
        border: 2px solid rgba(255, 255, 255, 0.4);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transition: all 0.3s ease;
    }
    
    .api-logo:hover {
        transform: scale(1.05);
        box-shadow: 
            0 12px 32px rgba(0, 0, 0, 0.25),
            0 6px 16px rgba(0, 0, 0, 0.2);
    }
    
    .api-location-name {
        padding: 0.85rem 1.75rem;
        /* Ajuster pour safe-area iOS */
        top: calc(0.75rem + env(safe-area-inset-top, 0));
        max-width: calc(100vw - 2rem - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin: 0 auto;
        text-align: center;
        border-radius: 18px;
        box-shadow: 
            0 12px 36px rgba(33, 150, 243, 0.4),
            0 6px 18px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.5),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1);
        border: 2.5px solid rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(25px) saturate(180%);
        -webkit-backdrop-filter: blur(25px) saturate(180%);
    }
    
    .api-location-name span {
        font-size: 1.05rem;
        font-weight: 900;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        text-shadow: 
            0 3px 6px rgba(0, 0, 0, 0.5),
            0 0 20px rgba(255, 255, 255, 0.35),
            0 1px 2px rgba(0, 0, 0, 0.3);
        letter-spacing: 0.8px;
    }
    
    .api-logo-container {
        /* Ajuster pour safe-area iOS */
        top: calc(0.75rem + env(safe-area-inset-top, 0));
        left: calc(0.75rem + env(safe-area-inset-left, 0));
        filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
        transition: transform 0.3s ease;
    }
    
    .api-logo-container:hover {
        transform: scale(1.05);
    }
    
    /* Ajustements pour la scène 3D en mode API sur mobile */
    body.api-mode .scene-container {
        height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
        min-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    }
    
    body.api-mode #scene3d {
        height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
        min-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    }
    
    body.api-mode #scene3d canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
        max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        /* Optimisation pour mobile */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Responsive pour très petits écrans (mobile portrait) */
@media (max-width: 480px) {
    .api-logo {
        max-width: 100px;
        max-height: 60px;
        padding: 0.5rem;
        border-radius: 12px;
        box-shadow: 
            0 6px 20px rgba(0, 0, 0, 0.2),
            0 3px 10px rgba(0, 0, 0, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
        border: 2px solid rgba(255, 255, 255, 0.4);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    .api-location-name {
        padding: 0.7rem 1.5rem;
        /* Ajuster pour safe-area iOS (notch) */
        top: calc(0.5rem + env(safe-area-inset-top, 0));
        max-width: calc(100vw - 1.5rem - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin: 0 auto;
        text-align: center;
        border-radius: 16px;
        box-shadow: 
            0 10px 32px rgba(33, 150, 243, 0.4),
            0 5px 16px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.5),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1);
        border: 2.5px solid rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }
    
    .api-location-name span {
        font-size: 0.95rem;
        font-weight: 900;
        text-shadow: 
            0 3px 6px rgba(0, 0, 0, 0.5),
            0 0 18px rgba(255, 255, 255, 0.35),
            0 1px 2px rgba(0, 0, 0, 0.3);
        letter-spacing: 0.7px;
    }
    
    .api-logo-container {
        /* Ajuster pour safe-area iOS */
        top: calc(0.5rem + env(safe-area-inset-top, 0));
        left: calc(0.5rem + env(safe-area-inset-left, 0));
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    }
    
    .api-overlay {
        padding: calc(0.5rem + env(safe-area-inset-top, 0)) 
                 calc(0.5rem + env(safe-area-inset-right, 0)) 
                 calc(0.5rem + env(safe-area-inset-bottom, 0)) 
                 calc(0.5rem + env(safe-area-inset-left, 0));
    }
    
    /* Ajustements supplémentaires pour très petits écrans */
    body.api-mode .scene-container {
        height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
    }
    
    body.api-mode #scene3d {
        height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0)) !important;
    }
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    margin: 0;
    gap: 1rem;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

/* Brand Section */
.header-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: translateX(2px);
}

.logo-icon {
    font-size: 1.75rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.brand-logo:hover .logo-icon {
    transform: scale(1.05);
}

.logo-text h1 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-indicator:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #48bb78;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(72, 187, 120, 0.5);
}

@keyframes pulse-dot {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 8px rgba(72, 187, 120, 0.5);
    }
    50% { 
        transform: scale(1.2);
        box-shadow: 0 0 12px rgba(72, 187, 120, 0.7);
    }
}

.status-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Action Groups - Compact Professional Design */
.action-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-group:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.action-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    margin-right: 0.25rem;
}

/* Modern Select */
.modern-select {
    min-width: 200px;
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 500;
}

.modern-select:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

.modern-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.modern-select option {
    background: #2a5298;
    color: white;
    padding: 0.5rem;
}

/* Icon Only Button */
.btn-icon-only {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    min-width: 32px;
    height: 32px;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px) rotate(90deg);
}

.btn-icon-only:active {
    transform: translateY(0) rotate(90deg);
}

.btn-icon-only .btn-icon {
    font-size: 0.95rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.header-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: auto;
    justify-content: center;
    white-space: nowrap;
}

.header-actions .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s ease;
}

.header-actions .btn:hover::before {
    left: 100%;
}

.btn-icon {
    font-size: 0.9rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-text {
    font-weight: 600;
    letter-spacing: 0.1px;
}

/* Button Variants */
.header-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.header-actions .btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.header-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-actions .btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.header-actions .btn-success:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-actions .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.header-actions .btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-actions .btn-outline {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
}

.header-actions .btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Button Active States */
.header-actions .btn:active {
    transform: translateY(0) scale(0.98);
    transition: transform 0.1s ease;
}

/* Loading State for Save Button */
.header-actions .btn-saving {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.header-actions .btn-saving::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Tooltip for buttons */
.header-actions .btn[title] {
    position: relative;
}

.header-actions .btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: tooltipFadeIn 0.2s ease;
}

.header-actions .btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    z-index: 1001;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Smooth transitions for all interactive elements */
.action-group,
.header-actions .btn,
.btn-icon-only,
.modern-select,
.status-indicator {
    will-change: transform;
}

/* Focus states for accessibility */
.header-actions .btn:focus-visible,
.btn-icon-only:focus-visible,
.modern-select:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Main Content */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: 360px;
    min-width: 340px;
    max-width: 400px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 2px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Scrollbar personnalisée pour la sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.sidebar-section {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.sidebar-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.sidebar-section small {
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.4;
    display: block;
    margin-top: 0.25rem;
}

.sidebar-section h3 {
    color: #1e293b;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #334155;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: normal;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: white;
}

.form-group input:hover,
.form-group select:hover {
    border-color: #cbd5e1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-info {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
}

/* Scene Container */
.scene-container { 
    flex: 1 1 0; 
    display: flex; 
    align-items: stretch; 
    justify-content: stretch; 
    min-height: 85vh; 
    height: 95vh; 
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    margin: 0.5rem;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 8px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    /* Optimisation pour mobile */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

#scene3d { 
    width: 100%; 
    height: 100%; 
    min-height: 85vh; 
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    border-radius: var(--radius-lg);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.06),
        inset 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative; 
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Optimisation pour mobile */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    /* Hardware acceleration pour meilleures performances */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

#scene3d canvas {
    /* Optimisation pour mobile */
    display: block;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-x pan-y pinch-zoom;
    /* Hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Empêcher la sélection de texte sur mobile */
    -webkit-user-select: none;
    user-select: none;
    /* Optimisation pour le rendu */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

#scene3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 70%, rgba(102, 126, 234, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 70% 30%, rgba(118, 75, 162, 0.1) 0%, transparent 40%);
    pointer-events: none;
    animation: ambientGlow 8s ease-in-out infinite alternate;
}

@keyframes ambientGlow {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

/* Variables CSS pour safe-area (iOS) */
:root {
    --safe-area-inset-top: env(safe-area-inset-top, 0);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0);
    --safe-area-inset-left: env(safe-area-inset-left, 0);
    --safe-area-inset-right: env(safe-area-inset-right, 0);
}

/* Responsive pour tablettes */
@media (max-width: 900px) {
    .scene-container { 
        min-height: 50vh; 
        height: 60vh; 
    }
    #scene3d { 
        min-height: 50vh; 
    }
}

/* Responsive pour tablettes en mode paysage */
@media (max-width: 1024px) and (orientation: landscape) {
    .scene-container {
        min-height: 70vh;
        height: 80vh;
    }
    
    #scene3d {
        min-height: 70vh;
    }
}

/* Responsive pour petits écrans en mode paysage */
@media (max-width: 768px) and (orientation: landscape) {
    .api-location-name {
        top: calc(0.5rem + env(safe-area-inset-top, 0));
        padding: 0.5rem 1.25rem;
    }
    
    .api-location-name span {
        font-size: 0.9rem;
    }
    
    .api-logo {
        max-width: 100px;
        max-height: 60px;
    }
    
    .color-legend {
        top: calc(0.5rem + env(safe-area-inset-top, 0));
        right: 0.5rem;
        padding: 0.75rem;
        min-width: 120px;
    }
    
    .stock-tooltip {
        max-height: calc(100vh - 4rem - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    }
}

.scene-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.scene-controls .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.scene-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.scene-controls .btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.scene-controls .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.scene-controls .btn:hover::before {
    left: 100%;
}

/* Statistics */
#stats {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

#stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(2px);
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1rem;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    z-index: 1000;
    display: none;
    min-width: 180px;
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.context-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    color: var(--text-primary);
    border-radius: var(--radius);
    margin: 0.125rem 0.5rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.context-menu-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.context-menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.context-menu-item:hover::before {
    left: 100%;
}

.context-menu-item .icon {
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.context-menu-item-danger {
    color: #dc3545;
}

.context-menu-item-danger:hover {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.context-menu-icon {
    margin-right: 0.5rem;
    font-size: 1rem;
}

.context-menu-text {
    flex: 1;
}

/* Tooltip de stock - Design amélioré */
.stock-tooltip {
    position: fixed;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.99) 100%);
    border: 3px solid #2196f3;
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(33, 150, 243, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 0 0 1px rgba(33, 150, 243, 0.1);
    padding: 0;
    z-index: 10000;
    pointer-events: none;
    max-width: 650px;
    max-height: 550px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    animation: tooltipFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top left;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Overlay pour fermer le tooltip sur mobile */
.stock-tooltip-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    z-index: 9999;
    pointer-events: auto;
    display: none;
    transition: opacity 0.2s ease;
}

.stock-tooltip-overlay.active {
    display: block;
    animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Bouton de fermeture du tooltip */
.stock-tooltip-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(33, 150, 243, 0.6);
    color: #2196f3;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: none; /* Masqué par défaut (desktop) */
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.2s ease;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    -webkit-tap-highlight-color: transparent; /* Supprimer le highlight sur mobile */
    user-select: none;
    touch-action: manipulation; /* Optimiser pour le touch */
    padding: 0;
    margin: 0;
}

/* Afficher le bouton sur mobile */
@media (max-width: 768px) {
    .stock-tooltip-close {
        display: flex !important;
    }
}

.stock-tooltip-close:hover {
    background: #2196f3;
    color: white;
    border-color: #1976d2;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.stock-tooltip-close:active {
    transform: scale(0.95);
    background: #1976d2;
}

/* Responsive pour les tooltips sur mobile */
@media (max-width: 768px) {
    .stock-tooltip {
        max-width: calc(100vw - 1.5rem);
        max-height: calc(100vh - 7rem);
        left: 0.75rem !important;
        right: 0.75rem !important;
        transform: none !important;
        top: auto !important;
        bottom: 0.75rem !important;
        pointer-events: auto !important; /* Activer les interactions sur mobile */
        touch-action: none; /* Empêcher les gestes sur le tooltip lui-même */
        overflow: visible !important; /* Permettre le scroll dans le body */
        /* Empêcher la propagation des événements vers la scène */
        isolation: isolate; /* Créer un nouveau contexte d'empilement */
        border-radius: 14px !important;
        border-width: 3px !important;
        box-shadow: 
            0 16px 48px rgba(33, 150, 243, 0.4),
            0 8px 24px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    }
    
    .stock-tooltip-body {
        overflow-y: auto !important;
        overflow-x: auto !important; /* Permettre aussi le scroll horizontal */
        -webkit-overflow-scrolling: touch !important; /* Scroll fluide sur iOS */
        overscroll-behavior: contain !important; /* Éviter le scroll de la page en arrière-plan */
        touch-action: pan-y pan-x !important; /* Permettre le scroll vertical ET horizontal */
        position: relative !important;
        will-change: scroll-position !important;
    }
    
    .stock-tooltip-close {
        display: flex !important;
        width: 2.75rem !important;
        height: 2.75rem !important;
        top: 0.75rem !important;
        right: 0.75rem !important;
        font-size: 1.6rem !important;
        background: rgba(255, 255, 255, 0.98) !important;
        border-width: 3px !important;
        border-color: rgba(33, 150, 243, 0.7) !important;
        position: absolute !important;
        z-index: 10002 !important;
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.25),
            0 2px 6px rgba(33, 150, 243, 0.2) !important;
        transition: all 0.2s ease !important;
    }
    
    .stock-tooltip-close:active {
        transform: scale(0.9) !important;
        background: rgba(33, 150, 243, 0.1) !important;
    }
    
    .stock-tooltip-header {
        padding: 1.1rem 1.35rem;
        flex-wrap: wrap;
        gap: 0.85rem;
        border-radius: 13px 13px 0 0;
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            inset 0 -1px 0 rgba(0, 0, 0, 0.05);
        border-bottom: 2.5px solid rgba(255, 255, 255, 0.3);
        background: linear-gradient(135deg, 
            #2196f3 0%, 
            #1976d2 40%,
            #1565c0 70%,
            #1976d2 100%);
        position: relative;
        overflow: hidden;
    }
    
    .stock-tooltip-header::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
        animation: headerShimmer 4s ease-in-out infinite;
        pointer-events: none;
    }
    
    @keyframes headerShimmer {
        0%, 100% {
            transform: translate(-50%, -50%) rotate(0deg);
            opacity: 0;
        }
        50% {
            transform: translate(-50%, -50%) rotate(180deg);
            opacity: 0.3;
        }
    }
    
    .stock-tooltip-title {
        flex: 1;
        min-width: 0;
    }
    
    .stock-tooltip-title strong {
        font-size: 1rem;
        font-weight: 800;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    
    .stock-tooltip-subtitle {
        font-size: 0.75rem;
        opacity: 0.95;
    }
    
    .stock-tooltip-icon {
        font-size: 1.4rem;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    }
    
    .stock-tooltip-total {
        padding: 0.7rem 1rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.35) !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        position: relative;
        z-index: 1;
    }
    
    .total-label {
        font-size: 0.7rem;
        opacity: 0.95;
        font-weight: 600;
    }
    
    .total-value {
        font-size: 1.15rem;
        font-weight: 800;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    .stock-tooltip-body {
        max-height: calc(100vh - 12rem);
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        touch-action: pan-y !important; /* Permettre le scroll vertical */
        /* Forcer le scroll sur mobile */
        position: relative;
        will-change: scroll-position;
        /* Empêcher la propagation des événements */
        pointer-events: auto !important;
    }
    
    .stock-tooltip-table {
        font-size: 0.8rem;
    }
    
    .stock-tooltip-table th,
    .stock-tooltip-table td {
        padding: 0.5rem 0.75rem;
    }
    
    .stock-tooltip-table th {
        font-size: 0.75rem;
    }
    
    .quantity-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
        min-width: 50px;
    }
}

@media (max-width: 480px) {
    .stock-tooltip {
        max-width: calc(100vw - 1rem);
        max-height: calc(100vh - 5.5rem);
        left: 0.5rem !important;
        right: 0.5rem !important;
        bottom: 0.5rem !important;
        border-radius: 12px !important;
        pointer-events: auto !important; /* Activer les interactions sur mobile */
        touch-action: pan-y; /* Permettre le scroll vertical */
        box-shadow: 
            0 12px 40px rgba(33, 150, 243, 0.35),
            0 6px 20px rgba(0, 0, 0, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    }
    
    .stock-tooltip-close {
        width: 2.5rem !important;
        height: 2.5rem !important;
        top: 0.6rem !important;
        right: 0.6rem !important;
        font-size: 1.5rem !important;
        background: rgba(255, 255, 255, 0.98) !important;
        border-width: 3px !important;
        border-color: rgba(33, 150, 243, 0.7) !important;
        position: absolute !important;
        z-index: 10002 !important;
        display: flex !important;
        box-shadow: 
            0 3px 10px rgba(0, 0, 0, 0.2),
            0 2px 5px rgba(33, 150, 243, 0.15) !important;
    }
    
    .stock-tooltip-header {
        padding: 0.95rem 1.15rem;
        border-radius: 12px 12px 0 0;
        box-shadow: 
            0 4px 10px rgba(0, 0, 0, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            inset 0 -1px 0 rgba(0, 0, 0, 0.05);
        border-bottom: 2.5px solid rgba(255, 255, 255, 0.3);
        background: linear-gradient(135deg, 
            #2196f3 0%, 
            #1976d2 40%,
            #1565c0 70%,
            #1976d2 100%);
        position: relative;
        overflow: hidden;
    }
    
    .stock-tooltip-header::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
        animation: headerShimmer 4s ease-in-out infinite;
        pointer-events: none;
    }
    
    .stock-tooltip-title strong {
        font-size: 0.95rem;
        font-weight: 800;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    .stock-tooltip-subtitle {
        font-size: 0.7rem;
        opacity: 0.95;
    }
    
    .stock-tooltip-icon {
        font-size: 1.3rem;
        filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
    }
    
    .stock-tooltip-total {
        padding: 0.6rem 0.85rem;
        border-radius: 9px;
        background: rgba(255, 255, 255, 0.35) !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
        box-shadow: 
            0 3px 10px rgba(0, 0, 0, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        position: relative;
        z-index: 1;
    }
    
    .total-label {
        font-size: 0.65rem;
        opacity: 0.95;
        font-weight: 600;
    }
    
    .total-value {
        font-size: 1.05rem;
        font-weight: 800;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    .stock-tooltip-body {
        max-height: calc(100vh - 10rem);
        overflow-y: auto !important;
        overflow-x: auto !important; /* Permettre aussi le scroll horizontal */
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        touch-action: pan-y pan-x !important; /* Permettre le scroll vertical ET horizontal */
        /* Forcer le scroll sur mobile */
        position: relative !important;
        will-change: scroll-position !important;
    }
    
    .stock-tooltip-table {
        font-size: 0.75rem;
    }
    
    .stock-tooltip-table th,
    .stock-tooltip-table td {
        padding: 0.4rem 0.5rem;
    }
    
    .stock-tooltip-table th {
        font-size: 0.7rem;
    }
    
    .th-icon {
        font-size: 0.8rem;
        margin-right: 0.3rem;
    }
    
    .quantity-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
        min-width: 45px;
    }
    
    /* Masquer certaines colonnes sur très petits écrans si nécessaire */
    .stock-tooltip-table .cell-lot,
    .stock-tooltip-table .cell-slot {
        font-size: 0.7rem;
    }
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stock-tooltip-header {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 50%, #1565c0 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: 13px 13px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative; /* Pour positionner le bouton de fermeture */
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.stock-tooltip-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stock-tooltip-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.stock-tooltip-title strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stock-tooltip-subtitle {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
    margin-top: 0.15rem;
}

.stock-tooltip-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.25);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.total-label {
    font-size: 0.7rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.15rem;
}

.stock-tooltip-body {
    max-height: 450px;
    overflow-y: auto;
    overflow-x: auto; /* Permettre aussi le scroll horizontal si nécessaire */
    pointer-events: auto; /* Permettre le scroll */
    -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
    overscroll-behavior: contain; /* Éviter le scroll de la page en arrière-plan */
    touch-action: pan-y pan-x; /* Permettre le scroll vertical ET horizontal */
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
}

.stock-tooltip-body::-webkit-scrollbar {
    width: 6px;
}

.stock-tooltip-body::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.stock-tooltip-body::-webkit-scrollbar-thumb {
    background: #2196f3;
    border-radius: 3px;
}

.stock-tooltip-body::-webkit-scrollbar-thumb:hover {
    background: #1976d2;
}

.stock-tooltip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.stock-tooltip-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stock-tooltip-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.th-icon {
    margin-right: 0.4rem;
    font-size: 0.9rem;
}

.stock-tooltip-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    transition: background-color 0.15s ease;
}

.stock-tooltip-table tbody tr.even {
    background: #ffffff;
}

.stock-tooltip-table tbody tr.odd {
    background: #f8f9fa;
}

.stock-tooltip-table tbody tr:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.stock-tooltip-table tbody tr:last-child td {
    border-bottom: none;
}

.cell-article,
.cell-lot,
.cell-slot {
    font-weight: 500;
    color: #212529;
}

.cell-quantity {
    text-align: right;
}

.quantity-badge {
    display: inline-block;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
    min-width: 60px;
    text-align: center;
}

.empty-value {
    color: #adb5bd;
    font-style: italic;
}

/* Notifications */
.notifications {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notification {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.1);
    max-width: 350px;
    animation: notificationSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.success::before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.error::before {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification.warning::before {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.notification.info::before {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .header-actions {
        gap: 1rem;
    }
    
    .action-group {
        gap: 0.5rem;
    }
    
    .header-actions .btn {
        min-width: 100px;
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 380px;
        min-width: 360px;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 0.625rem;
    }
    
    .action-group {
        padding: 0.3rem 0.625rem;
    }
    
    .modern-select {
        min-width: 180px;
        font-size: 0.8rem;
    }
    
    .logo-text h1 {
        font-size: 1.15rem;
    }
    
    .brand-subtitle {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        min-width: unset;
        max-width: unset;
    }
    
    .app-header {
        padding: 0.625rem 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .header-brand {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .action-group {
        width: 100%;
        flex-wrap: wrap;
        padding: 0.5rem;
    }
    
    .modern-select {
        flex: 1;
        min-width: 150px;
    }
    
    .header-actions .btn {
        flex: 1;
        min-width: 90px;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .status-indicator {
        width: 100%;
        justify-content: center;
    }
    
    .scene-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.5rem 0.75rem;
    }
    
    .logo-text h1 {
        font-size: 1.1rem;
    }
    
    .brand-subtitle {
        font-size: 0.65rem;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    .status-indicator {
        padding: 0.375rem 0.75rem;
    }
    
    .status-text {
        font-size: 0.7rem;
    }
    
    .action-group {
        padding: 0.375rem 0.5rem;
    }
    
    .action-label {
        font-size: 0.75rem;
    }
    
    .header-actions .btn {
        padding: 0.45rem 0.625rem;
        font-size: 0.7rem;
        min-width: auto;
    }
    
    .btn-text {
        display: none;
    }
    
    .btn-icon-only {
        min-width: 28px;
        height: 28px;
        padding: 0.375rem;
    }
    
    .modern-select {
        min-width: 120px;
        font-size: 0.75rem;
        padding: 0.45rem 0.75rem;
    }
    
    .btn-icon {
        font-size: 1.2rem;
    }
    
    .sidebar {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .sidebar-section {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modals */
.plan-selection-modal,
.plan-name-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Plan List */
.plan-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.plan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-elevated);
    transition: var(--transition);
}

.plan-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.plan-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.plan-info p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.plan-actions {
    display: flex;
    gap: 0.5rem;
}

/* Plan Name Modal */
.plan-name-modal .modal-content {
    max-width: 400px;
}

.plan-name-modal .modal-body {
    padding: 1.5rem;
}

.plan-name-modal .form-group {
    margin-bottom: 0;
}

.plan-name-modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.plan-name-modal .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.plan-name-modal .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Level Legend */
#levelLegend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.legend-color {
    width: 1rem;
    height: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.legend-item span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Palette Size Inputs */
.palette-size-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.size-input {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.size-input label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

.size-input input {
    padding: 0.375rem 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    text-align: center;
    transition: var(--transition);
}

.size-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgb(37 99 235 / 0.1);
}

/* Inventory Section */
.inventory-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

#selectedLocation {
    background-color: var(--background);
    font-weight: 500;
    color: var(--text-primary);
}

#qrCodeInput {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

/* Inventory Modal */
.inventory-modal .modal-content {
    max-width: 800px;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.inventory-table th,
.inventory-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.inventory-table th {
    background-color: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

.inventory-table tr:hover {
    background-color: var(--background);
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-occupied {
    background-color: rgb(16 185 129 / 0.1);
    color: var(--success-color);
}

.status-empty {
    background-color: rgb(100 116 139 / 0.1);
    color: var(--secondary-color);
}

/* Badge de sélection */
.selection-badge {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.selection-badge #selectionCount {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Panneau d'aide pour la création */
.creation-help-panel {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-width: 500px;
    z-index: 9998;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.help-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.help-panel-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.125rem;
    font-weight: 600;
}

.btn-close-help {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: var(--transition);
}

.btn-close-help:hover {
    background: var(--background);
    color: var(--text-primary);
}

.help-panel-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-step {
    display: flex;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.step-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.step-content small {
    display: block;
    margin-top: 0.5rem;
    color: var(--primary-color);
    font-style: italic;
}

/* Navigation Emplacements */
#locationList {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    background: var(--background);
    color: var(--text-primary);
    cursor: pointer;
    max-height: 200px;
    overflow-y: auto;
}

#locationList option {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
}

#locationList option:hover {
    background: var(--primary-color);
    color: white;
}

#locationList option:checked {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

#locationSearch {
    font-family: monospace;
    font-size: 0.9em;
}

.btn-transparent-active {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* Highlight amélioré pour survol */
.location-hover-highlight {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px;
}

/* Animation pulse pour bouton de suppression en masse */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
        transform: scale(1.05);
    }
}

/* ============= PLAN SELECTOR GALLERY ============= */

.plan-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, rgba(50, 60, 80, 0.85) 0%, rgba(30, 40, 60, 0.90) 100%),
        url('/images/2.jpg');
    background-size: cover;
    background-position: stretch stretch;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: 100000;
    overflow-y: auto;
    padding: 2rem;
}

.plan-selector-container {
    max-width: 1400px;
    margin: 0 auto;
}

.plan-selector-header {
    text-align: center;
    color: white;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plan-selector-header h1 {
    font-size: 2.5em;
    margin: 0 0 1rem 0;
    text-shadow: 
        2px 2px 8px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(255, 255, 255, 0.2);
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.plan-selector-header h2 {
    font-size: 1.5em;
    margin: 0;
    font-weight: normal;
    opacity: 0.95;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.5);
    color: #f0f4f8;
}

.plan-selector-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.3em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border: none;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInScale 0.6s ease 0.3s backwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.btn-large::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-large:hover::before {
    width: 300px;
    height: 300px;
}

.btn-large:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.btn-large > * {
    position: relative;
    z-index: 1;
}

.plan-selector-search {
    max-width: 600px;
    margin: 0 auto 2rem auto;
    animation: fadeInScale 0.6s ease 0.5s backwards;
}

.plan-selector-search input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1em;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.plan-selector-search input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.plan-selector-search input:focus {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
    background: white;
}

.plan-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.plan-gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: white;
}

.plan-gallery-loading .spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid white;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.plan-gallery-loading p {
    font-size: 1.2em;
    margin: 0;
}

.plan-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.plan-card:nth-child(1) { animation-delay: 0.1s; }
.plan-card:nth-child(2) { animation-delay: 0.15s; }
.plan-card:nth-child(3) { animation-delay: 0.2s; }
.plan-card:nth-child(4) { animation-delay: 0.25s; }
.plan-card:nth-child(5) { animation-delay: 0.3s; }
.plan-card:nth-child(6) { animation-delay: 0.35s; }
.plan-card:nth-child(7) { animation-delay: 0.4s; }
.plan-card:nth-child(8) { animation-delay: 0.45s; }
.plan-card:nth-child(9) { animation-delay: 0.5s; }
.plan-card:nth-child(n+10) { animation-delay: 0.55s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plan-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(102, 126, 234, 0.5);
}

.plan-card-thumbnail {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.plan-card:hover .plan-card-thumbnail {
    background: linear-gradient(135deg, #5a67d8 0%, #6a3a92 100%);
    transform: scale(1.05);
}

.plan-card-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

.plan-card-thumbnail svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.plan-card:hover .plan-card-thumbnail svg {
    transform: scale(1.1) translateY(-5px);
}

.plan-card-content {
    padding: 1.5rem;
}

.plan-card-title {
    font-size: 1.3em;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9em;
    color: #666;
}

.plan-card-meta div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.plan-card-actions {
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.plan-card-actions button {
    flex: 1;
    padding: 0.6rem;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.plan-card-actions .btn-open {
    background: #4CAF50;
    color: white;
}

.plan-card-actions .btn-open:hover {
    background: #45a049;
}

.plan-card-actions .btn-delete {
    background: #f44336;
    color: white;
}

.plan-card-actions .btn-delete:hover {
    background: #da190b;
}

.plan-card-actions .btn-duplicate {
    background: #2196F3;
    color: white;
}

.plan-card-actions .btn-duplicate:hover {
    background: #0b7dda;
}

.plan-gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.plan-gallery-empty p {
    font-size: 1.3em;
    margin: 1rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* ============= MODALS ============= */

/* Modal générique */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: none; /* Cachée par défaut */
    align-items: flex-start;
    justify-content: flex-end;
    z-index: 10000;
    padding: 1rem;
    pointer-events: none; /* Permet les clics sur le plan 3D */
}

/* Le contenu de la modal capture les événements */
.modal .modal-content {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(33, 150, 243, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideInRight 0.3s ease;
}

/* Modal d'affectation avec largeur augmentée */
#assignLocationModal .modal-content {
    max-width: 850px;
}

#assignLocationModal .modal-body {
    padding: 1.5rem 2rem;
}

#assignLocationModal .modal-body > div {
    margin-bottom: 1.25rem;
}

#assignLocationModal .modal-header h4 {
    font-size: 1.4em;
}

#assignLocationModal .modal-body h5 {
    font-size: 1.15em;
}

#assignLocationModal input,
#assignLocationModal select,
#assignLocationModal button {
    font-size: 1.05em;
    padding: 0.85rem 1rem;
}

#assignLocationModal .btn {
    min-width: 180px;
}

#assignLocationModal #paletteInfoAssign {
    font-size: 1.05em;
    padding: 1.25rem;
}

#assignLocationModal #selectedLocationInfo {
    padding: 1.25rem;
}

#assignLocationModal #selectedLocationCode {
    font-size: 1.6em;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ============= SCANNER DOUCHETTE ============= */

/* Champ scanner douchette */
#scannerInput {
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

#scannerInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    transform: scale(1.02);
}

#scannerInput::placeholder {
    color: #94A3B8;
    font-style: italic;
}

/* Animation de scan réussi */
@keyframes scanSuccess {
    0% {
        background: #D1FAE5;
        border-color: #10B981;
    }
    50% {
        background: #A7F3D0;
        border-color: #059669;
    }
    100% {
        background: #D1FAE5;
        border-color: #10B981;
    }
}

#scannerInput.scanning {
    animation: scanSuccess 0.5s ease-in-out;
}

/* Annotations Emplacements Occupés */
.location-annotation {
    position: absolute;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
    white-space: nowrap;
    z-index: 1000;
    animation: annotationPulse 2s ease-in-out infinite;
}

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

/* Modal Liste Emplacements Occupés */
#occupiedLocationsModal .modal-content {
    max-width: 900px;
}

#occupiedLocationsList {
    display: grid;
    gap: 1rem;
}

/* ==================== PANNEAU DÉTAILS PALETTE MODERNE ==================== */

.palette-details-panel {
    position: fixed;
    top: 0;
    right: -450px; /* Caché par défaut */
    width: 450px;
    height: 100vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 10001;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
}

.palette-details-panel.show {
    right: 0;
}

.palette-panel-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.palette-panel-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.palette-icon {
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.palette-title-content h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.palette-title-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.palette-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.palette-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.palette-panel-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #ffffff;
}

.palette-panel-footer {
    padding: 1.5rem;
    background: #f8fafc;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.palette-action-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.palette-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.palette-close-action-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.palette-close-action-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Contenu du panneau */
.palette-info-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.palette-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.palette-info-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.palette-info-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.palette-info-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.palette-info-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.palette-info-label {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.palette-details-section {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.palette-details-section h4 {
    margin: 0 0 1rem 0;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.palette-details-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.palette-details-grid strong {
    color: #475569;
    font-weight: 600;
}

.palette-details-grid span {
    color: #1e293b;
}

/* Responsive */
@media (max-width: 768px) {
    .palette-details-panel {
        width: 100vw;
        right: -100vw;
    }
    
    .palette-info-grid {
        grid-template-columns: 1fr;
    }
    
    .palette-details-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .palette-details-grid strong {
        margin-bottom: 0.25rem;
    }
}

/* Animation d'entrée */
@keyframes palettePanelSlideIn {
    from {
        right: -450px;
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        right: 0;
        opacity: 1;
        transform: translateX(0);
    }
}

.palette-details-panel.show {
    animation: palettePanelSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Micro-interactions et effets de survol */
.palette-info-item {
    position: relative;
    overflow: hidden;
}

.palette-info-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.palette-info-item:hover::before {
    left: 100%;
}

.palette-action-btn, .palette-close-action-btn {
    position: relative;
    overflow: hidden;
}

.palette-action-btn::before, .palette-close-action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.palette-action-btn:active::before, .palette-close-action-btn:active::before {
    width: 300px;
    height: 300px;
}

/* Effet de pulsation pour les icônes importantes */
.palette-info-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Animation d'apparition en cascade pour les éléments */
.palette-details-section {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.palette-details-section:nth-child(1) { animation-delay: 0.1s; }
.palette-details-section:nth-child(2) { animation-delay: 0.2s; }
.palette-details-section:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Effet de glassmorphism pour le header */
.palette-panel-header {
    position: relative;
}

.palette-panel-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: inherit;
    z-index: -1;
}

/* ==================== PANNEAU INVENTAIRE MODERNE ==================== */

.inventory-panel {
    position: fixed;
    top: 0;
    right: -500px; /* Caché par défaut */
    width: 500px;
    height: 100vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.2);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 10002;
    transition: right 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
}

.inventory-panel.show {
    right: 0;
}

.inventory-panel-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.inventory-panel-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.inventory-icon {
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.inventory-title-content h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.inventory-title-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.inventory-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.inventory-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.inventory-panel-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #ffffff;
}

.inventory-panel-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Informations de la palette */
.inventory-palette-info {
    margin-bottom: 2rem;
}

.palette-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid #3b82f6;
}

.palette-code {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.palette-details {
    color: #475569;
    font-size: 0.95rem;
}

/* Filtres et Recherche */
.inventory-filters {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.inventory-filters h4 {
    margin: 0 0 1.5rem 0;
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 600;
}

.filter-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-item label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.filter-input, .filter-select {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s ease;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.filter-btn:not(.secondary) {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.filter-btn:not(.secondary):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.filter-btn.secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.filter-btn.secondary:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Méthodes de sélection */
.inventory-selection-methods h4 {
    margin: 0 0 1.5rem 0;
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 600;
}

.method-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.method-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.method-card.active {
    border-color: #4f46e5;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.15);
}

.method-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.method-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 8px;
}

.method-card.active .method-icon {
    background: #dbeafe;
}

.method-title {
    flex: 1;
    font-weight: 600;
    color: #1e293b;
    font-size: 1.1rem;
}

.method-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.method-card:not(.active) .method-status {
    background: #f1f5f9;
    color: #64748b;
}

.method-card.active .method-status {
    background: #4f46e5;
    color: white;
}

.method-description {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.method-options {
    margin-bottom: 1rem;
}

.method-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
}

.method-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4f46e5;
}

.method-option:hover {
    color: #475569;
}

/* Indicateur de scanner de douchette */
.scanner-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    margin-bottom: 1rem;
    animation: scannerPulse 2s ease-in-out infinite;
}

.scanner-pulse {
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.scanner-indicator span {
    font-size: 0.9rem;
    color: #166534;
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

@keyframes scannerPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

.method-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    width: 100%;
}

.method-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.method-btn.active {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.method-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    transition: border-color 0.2s ease;
}

.method-select:focus {
    outline: none;
    border-color: #4f46e5;
}

.method-input-group {
    display: flex;
    gap: 0.75rem;
}

.method-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.method-input:focus {
    outline: none;
    border-color: #4f46e5;
}

/* Emplacement sélectionné */
.inventory-selected-location {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-left: 4px solid #22c55e;
}

.inventory-selected-location h4 {
    margin: 0 0 1rem 0;
    color: #166534;
    font-size: 1.1rem;
    font-weight: 600;
}

.selected-location-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid rgba(34, 197, 94, 0.1);
}

.location-code {
    font-size: 1.5rem;
    font-weight: 700;
    color: #166534;
    margin-bottom: 0.5rem;
}

.location-status {
    color: #059669;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.location-position {
    color: #64748b;
    font-size: 0.9rem;
}

/* Actions */
.inventory-actions {
    margin: 2rem 0;
}

.inventory-actions h4 {
    margin: 0 0 1rem 0;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.action-btn {
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.action-btn.primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.action-btn.secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.action-btn.secondary:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Statistiques */
.inventory-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

/* Responsive */
@media (max-width: 768px) {
    .inventory-panel {
        width: 100vw;
        right: -100vw;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .inventory-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .method-input-group {
        flex-direction: column;
    }
}

/* Animation d'entrée */
@keyframes inventoryPanelSlideIn {
    from {
        right: -500px;
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        right: 0;
        opacity: 1;
        transform: translateX(0);
    }
}

.inventory-panel.show {
    animation: inventoryPanelSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== AMÉLIORATIONS SCÈNE 3D ==================== */

/* Effets de particules flottantes */
.scene-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px, 80px 80px, 60px 60px;
    animation: floatingParticles 20s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes floatingParticles {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
    }
}

/* Amélioration des boutons de contrôle */
.scene-controls .btn {
    position: relative;
    overflow: hidden;
}

.scene-controls .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.scene-controls .btn:active::after {
    width: 300px;
    height: 300px;
}

/* Amélioration des modales */
.modal {
    backdrop-filter: blur(8px);
}

.modal .modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Effet de survol pour les éléments interactifs */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Animation de chargement pour la scène */
.scene-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

.scene-loading::before {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.occupied-location-item {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.occupied-location-item:hover {
    border-color: #2196F3;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
    transform: translateY(-2px);
}

.occupied-location-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 3px 8px rgba(33, 150, 243, 0.3);
}

.occupied-location-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.occupied-location-code {
    font-size: 1.3em;
    font-weight: bold;
    color: #1e293b;
}

.occupied-location-palette {
    font-size: 0.95em;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.occupied-location-palette strong {
    color: #334155;
}

.occupied-location-action {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.occupied-location-action .btn {
    min-width: 120px;
    padding: 0.6rem 1rem;
    font-size: 0.9em;
}

.occupied-locations-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.occupied-locations-empty svg {
    width: 100px;
    height: 100px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.occupied-locations-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.occupied-locations-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.occupied-locations-stat-value {
    font-size: 2em;
    font-weight: bold;
}

.occupied-locations-stat-label {
    font-size: 0.85em;
    opacity: 0.9;
}

/* Légende des couleurs */
.color-legend {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(248, 250, 252, 0.98) 50%,
        rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 18px;
    padding: 1.25rem 1.5rem;
    box-shadow: 
        0 16px 48px rgba(0, 0, 0, 0.18),
        0 6px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    border: 2.5px solid rgba(255, 255, 255, 0.5);
    z-index: 10;
    min-width: 160px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: legendFadeIn 0.5s ease-out;
}

/* Masquer la légende en mode API */
body.api-mode .color-legend {
    display: none !important;
}

@keyframes legendFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.color-legend:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 20px 56px rgba(0, 0, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.legend-title {
    font-size: 1.05rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 2.5px solid;
    border-image: linear-gradient(90deg, 
        rgba(226, 232, 240, 0.5) 0%,
        rgba(148, 163, 184, 0.8) 50%,
        rgba(226, 232, 240, 0.5) 100%) 1;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-title::before {
    content: '🎨';
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.legend-color {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2.5px solid rgba(0, 0, 0, 0.2);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.legend-color::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.legend-color:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.25),
        0 3px 6px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.3);
}

.legend-color:hover::before {
    opacity: 1;
}

.legend-label {
    font-size: 0.9rem;
    color: #334155;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: color 0.2s ease;
}

.legend-item:hover .legend-label {
    color: #1e293b;
}

/* Panneau des emplacements occupés - Styles pour la modale */

.panel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #64748b;
    gap: 0.75rem;
}

.loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.panel-empty {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.occupied-locations-list {
    padding: 0.5rem;
}

.occupied-location-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.occupied-location-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.occupied-location-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.occupied-location-code {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    font-family: 'Courier New', monospace;
}

.occupied-location-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #2d7a3d;
    color: white;
}

.occupied-location-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.occupied-location-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.occupied-location-detail-label {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.occupied-location-detail-value {
    color: #1e293b;
    font-weight: 500;
    word-break: break-word;
}

.occupied-location-detail-value.empty {
    color: #94a3b8;
    font-style: italic;
}

/* Amélioration de l'affichage dans la modale */
#occupiedLocationsModal .occupied-locations-list {
    padding: 1rem;
}

#occupiedLocationsModal .occupied-location-item {
    margin-bottom: 1rem;
}

#occupiedLocationsModal .occupied-location-details {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Responsive pour la légende */
@media (max-width: 900px) {
    .color-legend {
        top: calc(0.75rem + env(safe-area-inset-top, 0));
        right: calc(0.75rem + env(safe-area-inset-right, 0));
        padding: 1rem;
        min-width: 140px;
        border-radius: 12px;
        box-shadow: 
            0 8px 24px rgba(0, 0, 0, 0.12),
            0 3px 10px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.7);
        border: 2px solid rgba(255, 255, 255, 0.35);
    }
    
    .legend-title {
        font-size: 0.9rem;
        margin-bottom: 0.85rem;
        padding-bottom: 0.65rem;
    }
    
    .legend-item {
        gap: 0.65rem;
        padding: 0.4rem 0;
    }
    
    .legend-color {
        width: 26px;
        height: 26px;
        border-radius: 5px;
    }
    
    .legend-label {
        font-size: 0.85rem;
        font-weight: 600;
    }
}

@media (max-width: 768px) {
    .color-legend {
        top: calc(0.75rem + env(safe-area-inset-top, 0));
        right: calc(0.75rem + env(safe-area-inset-right, 0));
        padding: 1rem 1.25rem;
        min-width: 140px;
        border-radius: 16px;
        box-shadow: 
            0 12px 36px rgba(0, 0, 0, 0.15),
            0 5px 16px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.9);
        border: 2.5px solid rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }
    
    .legend-title {
        font-size: 0.95rem;
        margin-bottom: 0.85rem;
        padding-bottom: 0.7rem;
    }
    
    .legend-title::before {
        font-size: 1.1rem;
    }
    
    .legend-color {
        width: 28px;
        height: 28px;
        border-radius: 7px;
    }
    
    .legend-label {
        font-size: 0.85rem;
        font-weight: 700;
    }
}

@media (max-width: 480px) {
    .color-legend {
        top: calc(0.5rem + env(safe-area-inset-top, 0));
        right: calc(0.5rem + env(safe-area-inset-right, 0));
        padding: 0.9rem 1.1rem;
        min-width: 135px;
        border-radius: 14px;
        box-shadow: 
            0 10px 32px rgba(0, 0, 0, 0.15),
            0 4px 16px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.9);
        border: 2.5px solid rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(18px) saturate(180%);
        -webkit-backdrop-filter: blur(18px) saturate(180%);
    }
    
    .legend-title {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.65rem;
    }
    
    .legend-title::before {
        font-size: 1rem;
    }
    
    .legend-item {
        gap: 0.7rem;
        padding: 0.4rem 0;
    }
    
    .legend-color {
        width: 26px;
        height: 26px;
        border-radius: 6px;
    }
    
    .legend-label {
        font-size: 0.82rem;
        font-weight: 700;
    }
}

/* Responsive pour très petits écrans Android (320px, 360px) */
@media (max-width: 360px) {
    .api-location-name {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        max-width: calc(100vw - 1.5rem - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin: 0 auto;
        text-align: center;
    }
    
    .api-location-name span {
        font-size: 0.85rem;
    }
    
    .api-logo {
        max-width: 75px;
        max-height: 45px;
    }
    
    .color-legend {
        padding: 0.75rem;
        min-width: 120px;
    }
    
    .legend-title {
        font-size: 0.8rem;
    }
    
    .legend-color {
        width: 22px;
        height: 22px;
    }
    
    .legend-label {
        font-size: 0.75rem;
    }
    
    .stock-tooltip {
        max-width: calc(100vw - 1rem) !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
    }
}

/* Support pour iOS spécifiquement */
@supports (-webkit-touch-callout: none) {
    body.api-mode {
        /* iOS Safari */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .api-location-name {
        /* Ajuster pour notch iOS */
        top: calc(1.5rem + env(safe-area-inset-top, 0));
    }
    
    .api-logo-container {
        top: calc(1.5rem + env(safe-area-inset-top, 0));
        left: calc(1.5rem + env(safe-area-inset-left, 0));
    }
}

/* Support pour Android Chrome */
@supports not (-webkit-touch-callout: none) {
    body.api-mode {
        /* Android Chrome - pas de safe-area nécessaire généralement */
        padding: 0;
    }
}

/* Menu Contextuel */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 100000;
    min-width: 220px;
    padding: 0.5rem 0;
    display: none;
    animation: contextMenuFadeIn 0.15s ease;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-header {
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.9em;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.context-menu-item {
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9em;
    color: #334155;
}

.context-menu-item:hover {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

.context-menu-item:active {
    transform: scale(0.98);
}

.context-menu-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.context-menu-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.context-menu-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 0.5rem 0;
}

.context-menu-danger:hover {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

/* Animation de sortie */
.context-menu.hiding {
    animation: contextMenuFadeOut 0.15s ease;
}

@keyframes contextMenuFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

