/* static/css/widget_layout.css */

/* Animación de vibración estilo iPhone (Suavizada) */
@keyframes iosWiggle {
    0% { transform: rotate(-0.3deg) translateX(-1px); }
    50% { transform: rotate(0.5deg) translateX(1px); }
    100% { transform: rotate(-0.3deg) translateX(-1px); }
}

/* Base del Widget: Limpio, transiciones fluidas y diseño sin bordes toscos */
.dashboard-widget {
    min-width: 0; 
    position: relative;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.dashboard-widget:hover {
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.08);
}

/* Estado de edición: Bloqueo de interacciones internas y vibración */
.edit-mode-active .dashboard-widget {
    animation: iosWiggle 0.4s infinite ease-in-out;
    cursor: grab !important;
    user-select: none;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1), 0 10px 15px -6px rgba(0, 0, 0, 0.05);
    transform: scale(0.98);
}

/* Capa transparente tipo cristal para evitar clicks en los gráficos mientras se edita */
.edit-mode-active .dashboard-widget::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 100;
    cursor: grab;
    background: rgba(var(--bg-tarjeta-rgb, 255, 255, 255), 0.1);
    backdrop-filter: blur(1px);
    border: 2px dashed var(--color-acento, #6366F1);
    border-radius: inherit;
    transition: all 0.2s ease;
}

.edit-mode-active .dashboard-widget:active::after {
    cursor: grabbing;
    background: rgba(var(--bg-tarjeta-rgb, 255, 255, 255), 0.2);
}

/* Área de gráficos disponibles */
#hidden-charts-area {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(10px);
}

.edit-mode-active #hidden-charts-area {
    display: grid;
    opacity: 1;
    transform: translateY(0);
    border-top: 1px solid var(--borde-secundario);
    padding-top: 2.5rem;
    margin-top: 1.5rem;
}

/* Estilo del Botón Divisor */
.btn-gate-divider {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-width: 2px;
    background: rgba(var(--bg-tarjeta-rgb, 255, 255, 255), 0.02);
}

.edit-mode-active .btn-gate-divider {
    border-color: var(--color-acento);
    background-color: var(--bg-secundario);
    transform: scale(0.98) translateY(5px);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

.sortable-ghost {
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(0.5) blur(1px);
}

/* CUSTOM APEXCHARTS TOOLTIPS (Efecto Glassmorphism Premium) */
.apexcharts-custom-tooltip {
    background: rgba(var(--bg-tarjeta-rgb, 255, 255, 255), 0.85) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid var(--borde-secundario) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
}

.apexcharts-tooltip-title {
    background: rgba(var(--bg-secundario-rgb, 243, 244, 246), 0.5) !important;
    border-bottom: 1px solid var(--borde-secundario) !important;
    font-weight: 700 !important;
    font-family: inherit !important;
}

/* SOLUCIÓN: Limita las leyendas para que no destruyan el gráfico y agrega scroll premium */
.apexcharts-legend {
    max-height: 85px !important; 
    overflow-y: auto !important;
    align-items: flex-start !important; 
}

.apexcharts-legend::-webkit-scrollbar {
    width: 6px;
}

.apexcharts-legend::-webkit-scrollbar-track {
    background: transparent; 
}

.apexcharts-legend::-webkit-scrollbar-thumb {
    background-color: var(--borde-secundario, #d1d5db); 
    border-radius: 20px;
}

.apexcharts-legend::-webkit-scrollbar-thumb:hover {
    background-color: var(--texto-secundario, #9ca3af); 
}