/* Photo Remarques Editor - Système d'annotation de photos */

.photo-remarques-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

/* Viewport pour le zoom */
.image-viewport {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    cursor: default;
    max-height: 80vh;
    touch-action: none; /* Désactive le zoom natif du navigateur */
}

/* Curseurs selon l'état */
.image-viewport.zoomed {
    cursor: grab;
}

.image-viewport.zoomed:active,
.image-viewport.panning {
    cursor: grabbing;
}

.photo-remarques-container.edit-mode .image-viewport:not(.zoomed) {
    cursor: crosshair;
}

/* Container de l'image avec zoom */
.image-container {
    position: relative;
    transform-origin: 0 0;
    transition: transform 0.1s ease-out;
}

.photo-remarques-image {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Marqueurs sur l'image */
.remarque-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #ff4444;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 8px;
    font-weight: bold;
}

/* Curseurs selon le mode */
.photo-remarques-container:not(.edit-mode) .remarque-marker {
    cursor: pointer;
}

.photo-remarques-container.edit-mode .remarque-marker {
    cursor: move;
}

.photo-remarques-container.edit-mode .image-viewport {
    cursor: grab;
}

.photo-remarques-container.edit-mode .image-viewport:active {
    cursor: grabbing;
}

.photo-remarques-container.edit-mode .image-viewport.panning {
    cursor: grabbing;
}

.remarque-marker .marker-number {
    font-size: 8px;
    line-height: 1;
    margin-bottom: 1px;
}

.remarque-marker i {
    font-size: 10px;
    line-height: 1;
}

.remarque-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    background: #ff0000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.remarque-marker.active {
    background: #00aa00;
    transform: translate(-50%, -50%) scale(1.3);
}

/* Tooltip des remarques */
.remarque-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    max-width: 200px;
    white-space: pre-wrap;
    word-wrap: break-word;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.remarque-tooltip.visible {
    opacity: 1;
}

.remarque-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0,0,0,0.9);
}

/* Panneau latéral des remarques */
.remarques-panel {
    position: absolute;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: white;
    border-left: 2px solid #ddd;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 50;
    overflow-y: auto;
}

.remarques-panel.open {
    right: 0;
}

.remarques-header {
    background: #4a90e2;
    color: white;
    padding: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remarques-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remarques-list {
    padding: 15px;
}

.remarque-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.remarque-item:hover {
    background: #e3f2fd;
    border-color: #4a90e2;
}

.remarque-item.active {
    background: #e8f5e8;
    border-color: #00aa00;
}

.remarque-number {
    display: inline-block;
    background: #4a90e2;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 8px;
}

.remarque-text {
    font-size: 14px;
    line-height: 1.4;
    margin: 8px 0;
}

.remarque-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.remarque-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.remarque-btn:hover {
    background: #5a6268;
}

.remarque-btn.edit {
    background: #ffc107;
}

.remarque-btn.edit:hover {
    background: #e0a800;
}

.remarque-btn.delete {
    background: #dc3545;
}

.remarque-btn.delete:hover {
    background: #c82333;
}

/* Barre d'outils */
.photo-remarques-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255,255,255,0.95);
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 20;
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.toolbar-btn.active {
    background: #00aa00;
}

.toolbar-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Groupe de contrôles zoom */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px;
}

.zoom-level {
    color: white;
    font-size: 12px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 6px;
    border-radius: 3px;
}

/* Mode édition */
.photo-remarques-container.edit-mode {
    cursor: crosshair;
}

.photo-remarques-container.edit-mode .remarque-marker {
    cursor: grab;
}

.photo-remarques-container.edit-mode .remarque-marker:active {
    cursor: grabbing;
}

/* Formulaire d'édition de remarque */
.remarque-form {
    background: white;
    border: 2px solid #4a90e2;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    position: absolute;
    z-index: 200;
    min-width: 250px;
    max-width: 300px;
}

.remarque-form textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.remarque-form .form-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.remarque-form .btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.remarque-form .btn-save {
    background: #00aa00;
    color: white;
}

.remarque-form .btn-cancel {
    background: #6c757d;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .remarques-panel {
        width: 280px;
        right: -300px;
    }
    
    .photo-remarques-toolbar {
        position: relative;
        margin-bottom: 10px;
        justify-content: center;
    }
    
    .remarque-tooltip {
        max-width: 150px;
        font-size: 12px;
    }
    
    .remarque-form {
        max-width: 250px;
    }
}

/* Animation d'apparition */
@keyframes markerAppear {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.remarque-marker.new {
    animation: markerAppear 0.4s ease;
}

/* États des marqueurs */
.remarque-marker.warning {
    background: #ff8c00;
}

.remarque-marker.error {
    /* @directive self; */
    /* @directive next: fas-exclamation-triangle; */
    background: #ff4444;
}

.remarque-marker.info {
    background: #4a90e2;
}

.remarque-marker.success {
    background: #28a745;
}

/* Adaptations par plateforme */

/* Desktop - paramètres par défaut */
.platform-desktop .remarque-marker {
    width: 24px;
    height: 24px;
    font-size: 8px;
}

/* Tablette - marqueurs plus grands */
.platform-tablet .remarque-marker {
    width: 32px;
    height: 32px;
    font-size: 10px;
}

.platform-tablet .remarque-marker .marker-number {
    font-size: 10px;
}

.platform-tablet .remarque-marker i {
    font-size: 12px;
}

/* Mobile - marqueurs encore plus grands et interface simplifiée */
.platform-mobile .remarque-marker {
    width: 40px;
    height: 40px;
    font-size: 12px;
}

.platform-mobile .remarque-marker .marker-number {
    font-size: 12px;
}

.platform-mobile .remarque-marker i {
    font-size: 14px;
}

.platform-mobile .photo-remarques-toolbar {
    padding: 8px;
    gap: 8px;
}

.platform-mobile .toolbar-btn {
    padding: 12px 16px;
    font-size: 16px;
}

.platform-mobile .zoom-level {
    font-size: 14px;
    padding: 6px 8px;
}

/* Interface compacte mobile */
.platform-mobile.compact-ui .remarques-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 40vh;
    border-radius: 12px 12px 0 0;
}

/* Responsive breakpoints */
@media (max-width: 768px) {
