/**
 * Estilos para el sistema de Modo Edición
 */

/* Contenedor de controles de edición */
.edit-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: none;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    border: 1px solid #dee2e6;
    pointer-events: auto;
}

/* Iconos de edición y eliminación */
.edit-controls .edit-icon,
.edit-controls .delete-icon {
    font-size: 16px;
    margin: 0 3px;
    cursor: pointer;
    padding: 6px;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
    z-index: 10001;
    pointer-events: auto;
    min-width: 24px;
    min-height: 24px;
    text-align: center;
    line-height: 1;
}

.edit-controls .edit-icon {
    color: #00AEA9;
}

.edit-controls .edit-icon:hover {
    background-color: #00AEA9;
    color: white;
    transform: scale(1.1);
}

.edit-controls .delete-icon {
    color: #dc3545;
}

.edit-controls .delete-icon:hover {
    background-color: #dc3545;
    color: white;
    transform: scale(1.1);
}

/* Elementos editables en modo edición */
.editable {
    position: relative;
    transition: all 0.3s ease;
}

.editable:hover .edit-controls {
    display: block !important;
    opacity: 1;
    visibility: visible;
}

/* Indicador visual cuando el modo edición está activo */
body.edit-mode-active {
    position: relative;
}

/* Estilo base para el botón de modo edición */
#edit-mode-toggle,
#edit-mode-toggle-desktop {
    background: rgba(0, 174, 169, 0.1) !important;
    color: #00AEA9 !important;
    border: 2px solid #00AEA9 !important;
    border-radius: 20px !important;
    padding: 8px 16px !important;
    margin: 4px 8px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
    min-width: 140px !important;
    text-align: center !important;
    line-height: 1.2 !important;
}

/* Hover para modo OFF */
#edit-mode-toggle:hover,
#edit-mode-toggle-desktop:hover {
    background: rgba(0, 174, 169, 0.2) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 174, 169, 0.3) !important;
}

/* Estilo cuando el modo edición está activo (ON) */
body.edit-mode-active #edit-mode-toggle,
body.edit-mode-active #edit-mode-toggle-desktop {
    background: #00AEA9 !important;
    color: white !important;
    border: 2px solid #00AEA9 !important;
    box-shadow: 0 2px 8px rgba(0, 174, 169, 0.4) !important;
}

/* Hover para modo ON */
body.edit-mode-active #edit-mode-toggle:hover,
body.edit-mode-active #edit-mode-toggle-desktop:hover {
    background: #008a85 !important;
    border-color: #008a85 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 12px rgba(0, 174, 169, 0.5) !important;
}

/* Estilo sutil para el dropdown del usuario */
.edit-mode-dropdown-link {
    background: none !important;
    border: none !important;
    color: #666 !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
    font-size: inherit !important; /* Usar el mismo tamaño que las demás opciones */
    font-weight: inherit !important; /* Usar el mismo peso que las demás opciones */
    /* Usar el mismo padding que los demás items del dropdown: 12px uniforme */
    padding: 12px !important;
    display: block !important;
}

/* Cuando el modo edición está activo */
body.edit-mode-active .edit-mode-dropdown-link {
    color: #00AEA9 !important;
    font-weight: inherit !important; /* Mantener el mismo peso, solo cambiar color */
}

/* Hover para el dropdown */
.edit-mode-dropdown-link:hover {
    color: #00AEA9 !important;
    background: rgba(0, 174, 169, 0.1) !important;
}

/* Asegurar espaciado consistente entre icono y texto en dropdown */
.dropdown-menu i.me-2 {
    margin-right: 0.5rem !important;
}

/* Hacer el dropdown del usuario más ancho para evitar que el texto se corte */
.nav-item.dropdown .dropdown-menu {
    min-width: 200px !important;
    width: auto !important;
    white-space: nowrap !important;
}

/* Indicador visual removido - ahora usamos solo el botón integrado */

body.edit-mode-active .cd-panel__container {
    top: 30px;
}

/* Estilos para el modal de edición */
#edit-element-modal .modal-dialog {
    max-width: 800px;
}

#edit-element-modal .form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

#edit-element-modal .form-control,
#edit-element-modal .form-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#edit-element-modal .form-control:focus,
#edit-element-modal .form-select:focus {
    border-color: #00AEA9;
    box-shadow: 0 0 0 0.2rem rgba(0, 174, 169, 0.25);
}

/* Botón de modo edición activo */
#edit-mode-toggle,
#edit-mode-toggle-mobile {
    transition: all 0.3s ease;
}

#edit-mode-toggle:hover,
#edit-mode-toggle-mobile:hover {
    background-color: rgba(0, 174, 169, 0.1);
}

/* Animaciones para los iconos */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.edit-controls .edit-icon:hover,
.edit-controls .delete-icon:hover {
    animation: pulse 0.6s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .edit-controls {
        top: 3px;
        right: 3px;
        padding: 3px;
    }
    
    .edit-controls .edit-icon,
    .edit-controls .delete-icon {
        font-size: 14px;
        margin: 0 2px;
        padding: 3px;
    }
    
    body.edit-mode-active .unmdp_status_m {
        top: 25px;
        height: 50px;
    }
}

/* Estilos para elementos eliminados */
.editable.eliminated {
    opacity: 0.5;
    text-decoration: line-through;
    background-color: rgba(220, 53, 69, 0.1);
}

/* Tooltip personalizado para iconos */
.edit-controls [title] {
    position: relative;
}

.edit-controls [title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
    margin-bottom: 5px;
}

.edit-controls [title]:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
    z-index: 1001;
    margin-bottom: 1px;
}

/* Estilos para el indicador de carga del modo edición */
#edit-mode-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#edit-mode-loader > div {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Mejoras visuales para elementos editables */
.editable {
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 2px;
    margin: 1px;
}

.editable:hover {
    border-color: rgba(0, 174, 169, 0.3);
    background-color: rgba(0, 174, 169, 0.05);
}

/* Estilos para diferentes tipos de elementos editables */
.editable.card {
    border-radius: 8px;
}

.editable.news-item,
.editable.article {
    border-radius: 6px;
}

.editable.image-container {
    border-radius: 8px;
    overflow: hidden;
}

.editable.text-content {
    border-radius: 4px;
    padding: 8px;
}
