/* 
 * Styles pour le menu Édition et les outils de sélection
 * WallSim3D - Edit Menu Styles
 */

/* ===============================================
 * BOÎTE DE SÉLECTION
 * =============================================== */

.selection-box {
    position: fixed;
    border: 2px dashed #3498db;
    background: rgba(52, 152, 219, 0.1);
    backdrop-filter: blur(2px);
    z-index: 10000;
    pointer-events: none;
    animation: selectionPulse 1.5s ease-in-out infinite;
}

@keyframes selectionPulse {
    0%, 100% {
        opacity: 0.8;
        border-color: #3498db;
    }
    50% {
        opacity: 0.4;
        border-color: #2980b9;
    }
}

/* ===============================================
 * INDICATEUR DE SÉLECTION
 * =============================================== */

.selection-status {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.9), rgba(41, 128, 185, 0.9));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    z-index: 9999;
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: all 0.3s ease;
}

.selection-status.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.selection-status i {
    margin-right: 6px;
}

/* ===============================================
 * ÉLÉMENTS SÉLECTIONNÉS
 * =============================================== */

.element-selected {
    outline: 2px solid #3498db !important;
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5) !important;
}

.element-highlighted {
    outline: 2px dashed #f39c12 !important;
    outline-offset: 2px;
    animation: highlightPulse 2s ease-in-out infinite;
}

@keyframes highlightPulse {
    0%, 100% {
        outline-color: #f39c12;
        box-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
    }
    50% {
        outline-color: #e67e22;
        box-shadow: 0 0 15px rgba(243, 156, 18, 0.6);
    }
}

/* ===============================================
 * CONTRÔLES DE TRANSFORMATION
 * =============================================== */

.transform-controls {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 20, 0.9));
    border: 2px solid rgba(52, 152, 219, 0.5);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    gap: 10px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: all 0.3s ease;
}

.transform-controls.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.transform-btn {
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.2), rgba(52, 152, 219, 0.3));
    border: 1px solid rgba(52, 152, 219, 0.5);
    border-radius: 6px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.transform-btn:hover {
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.3), rgba(52, 152, 219, 0.4));
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.transform-btn.active {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border-color: #2980b9;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.transform-btn i {
    font-size: 14px;
}

/* ===============================================
 * PRESSE-PAPIERS VISUEL
 * =============================================== */

.clipboard-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(145deg, rgba(39, 174, 96, 0.9), rgba(34, 153, 84, 0.9));
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    z-index: 9999;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

.clipboard-indicator.visible {
    opacity: 1;
    transform: translateX(0);
}

.clipboard-indicator.cut {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.9), rgba(192, 57, 43, 0.9));
}

.clipboard-indicator i {
    margin-right: 8px;
    font-size: 14px;
}

/* ===============================================
 * HISTORIQUE ANNULER/RÉTABLIR
 * =============================================== */

.undo-redo-history {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 250px;
    max-height: 300px;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 20, 0.95));
    border: 2px solid rgba(52, 152, 219, 0.5);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.undo-redo-history.visible {
    opacity: 1;
    transform: translateX(0);
}

.undo-redo-history h4 {
    color: #3498db;
    margin: 0;
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3);
    background: rgba(52, 152, 219, 0.1);
}

.history-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    color: #ecf0f1;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(52, 152, 219, 0.2);
}

.history-item.current {
    background: rgba(52, 152, 219, 0.3);
    color: #3498db;
    font-weight: 500;
}

.history-item.future {
    opacity: 0.6;
    font-style: italic;
}

.history-item i {
    width: 16px;
    text-align: center;
    color: #3498db;
}

.history-item-time {
    margin-left: auto;
    color: #7f8c8d;
    font-size: 10px;
}

/* ===============================================
 * MENU CONTEXTUEL
 * =============================================== */

.context-menu {
    position: fixed;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 20, 0.95));
    border: 2px solid rgba(52, 152, 219, 0.5);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    min-width: 180px;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s ease;
    overflow: hidden;
}

.context-menu.visible {
    opacity: 1;
    transform: scale(1);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    color: #ecf0f1;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.context-menu-item:hover {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.context-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.context-menu-item.disabled:hover {
    background: none;
    color: #ecf0f1;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.context-menu-separator {
    height: 1px;
    background: rgba(52, 152, 219, 0.3);
    margin: 4px 0;
}

.context-menu-shortcut {
    margin-left: auto;
    color: #7f8c8d;
    font-size: 11px;
}

/* ===============================================
 * INDICATEURS D'ÉTAT DES BOUTONS
 * =============================================== */

.menu-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.menu-option.has-content::after {
    content: '●';
    color: #27ae60;
    font-size: 8px;
    position: absolute;
    top: 4px;
    right: 8px;
    animation: contentPulse 2s ease-in-out infinite;
}

@keyframes contentPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ===============================================
 * ANIMATION DE FEEDBACK
 * =============================================== */

.action-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.95), rgba(41, 128, 185, 0.95));
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 10002;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    animation: feedbackPop 0.6s ease-out forwards;
}

@keyframes feedbackPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.action-feedback.success {
    background: linear-gradient(145deg, rgba(39, 174, 96, 0.95), rgba(34, 153, 84, 0.95));
}

.action-feedback.error {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.95), rgba(192, 57, 43, 0.95));
}

.action-feedback.warning {
    background: linear-gradient(145deg, rgba(243, 156, 18, 0.95), rgba(230, 126, 34, 0.95));
}

/* ===============================================
 * SCROLLBAR PERSONNALISÉE
 * =============================================== */

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.5);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.7);
}

/* ===============================================
 * RESPONSIVE
 * =============================================== */

@media (max-width: 768px) {
    .transform-controls {
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .transform-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .undo-redo-history {
        width: 200px;
        max-height: 200px;
    }
    
    .selection-status {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .clipboard-indicator {
        font-size: 11px;
        padding: 8px 12px;
    }
}

/* ===============================================
 * THÈME CLAIR
 * =============================================== */

body.light-theme .selection-box {
    border-color: #2980b9;
    background: rgba(41, 128, 185, 0.1);
}

body.light-theme .transform-controls,
body.light-theme .undo-redo-history,
body.light-theme .context-menu {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
    border-color: rgba(52, 152, 219, 0.3);
    color: #2c3e50;
}

body.light-theme .context-menu-item,
body.light-theme .history-item {
    color: #2c3e50;
}

body.light-theme .context-menu-item:hover,
body.light-theme .history-item:hover {
    background: rgba(52, 152, 219, 0.1);
}

body.light-theme .history-item.current {
    background: rgba(52, 152, 219, 0.2);
}

/* ===============================================
 * ACCESSIBILITÉ
 * =============================================== */

.selection-box,
.selection-status,
.clipboard-indicator {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

@media (prefers-reduced-motion: reduce) {
    .selection-box,
    .element-highlighted,
    .menu-option.has-content::after {
        animation: none;
    }
}

/* Focus pour l'accessibilité */
.transform-btn:focus,
.context-menu-item:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* ============================================
   INDICATEURS VISUELS AVANCÉS
   ============================================ */

.clipboard-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 12px 18px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 10001;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.clipboard-indicator.show {
    transform: translateX(0);
}

.clipboard-indicator i {
    font-size: 14px;
}

.history-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    color: #e0e0e0;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-family: 'Segoe UI', -apple-system, sans-serif;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: all 0.2s ease;
}

.history-indicator:hover {
    background: linear-gradient(135deg, #252525, #353535);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.6), 0 2px 5px rgba(0, 0, 0, 0.4);
}

.history-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.undo-count {
    color: #ff6b6b;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 107, 107, 0.3);
}

.redo-count {
    color: #51cf66;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(81, 207, 102, 0.3);
}

.separator {
    color: #666;
    font-weight: 300;
    opacity: 0.7;
}

/* Contrôles de transformation modernes */
#transformControls {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(44, 62, 80, 0.95);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 180px;
}

#transformControls.visible {
    transform: translateX(0);
}

.transform-group {
    display: flex;
    gap: 8px;
    margin-bottom: 5px;
}

.transform-group:last-child {
    margin-bottom: 0;
}

#selectionStatus {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 10000;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    backdrop-filter: blur(5px);
}

#selectionStatus.visible {
    transform: translateY(0);
    animation: selectionPulse 2s infinite ease-in-out;
}

@keyframes selectionPulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    }
    50% { 
        box-shadow: 0 4px 25px rgba(39, 174, 96, 0.6);
    }
}

/* Notifications d'édition */
.edit-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    z-index: 10002;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.edit-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.edit-notification.success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 10px 30px rgba(39, 174, 96, 0.3);
}

.edit-notification.warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 10px 30px rgba(243, 156, 18, 0.3);
}

.edit-notification.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.3);
}
