/* Drag & Drop Styles */
.drag-container.dragging .widget-wrap { pointer-events: none; }

.drag-item {
    cursor: move;
    transition: all 0.2s ease;
}

.drag-item:hover {
    cursor: move;
    transform: scale(1.02);
}

.drag-item.dragging {
    cursor: move;
    opacity: 0.6;
    transform: rotate(5deg) scale(0.95);
    z-index: 1000;
    position: relative;
}

.drag-item .widget-wrap {
    border: 2px dashed transparent;
    transition: border-color 0.2s ease;
}

.drag-item.over .widget-wrap {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.drag-item.dragging .widget-wrap {
    border-color: #28a745;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Feedback visivo durante il drag */
.drag-container.dragging {
    background-color: rgba(0, 0, 0, 0.02);
}

.temp-placeholder {
    display: none !important;
}

/* Feedback visivo per drop non permesso */
.drag-item.drop-not-allowed .widget-wrap {
    border: 2px solid #e74c3c !important;
    background-color: rgba(231, 76, 60, 0.1) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
}

/* Stile personalizzato per KPI specifico - ID 1 */
.drag-item[data-id="1"] .widget-box,
.drag-item[data-id="1"] .kpi,
.kpi-1 {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3) !important;
}

/* Titolo e testi del KPI verde */
.drag-item[data-id="1"] .widget-box__title,
.kpi-1 .widget-box__title {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.drag-item[data-id="1"] .widget-box__title strong,
.drag-item[data-id="1"] .kpi-value,
.drag-item[data-id="1"] .kpi-body-content small,
.drag-item[data-id="1"] .old-value,
.kpi-1 .widget-box__title strong,
.kpi-1 .kpi-value,
.kpi-1 .kpi-body-content small,
.kpi-1 .old-value {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Icona del KPI verde */
.drag-item[data-id="1"] .icon-kpi,
.kpi-1 .icon-kpi {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.drag-item[data-id="1"] .icon-kpi ion-icon,
.kpi-1 .icon-kpi ion-icon {
    color: white !important;
}

/* Pulsante settings del KPI verde */
.drag-item[data-id="1"] .button-modal-icon,
.kpi-1 .button-modal-icon {
    color: white !important;
    background-color: transparent !important;
}

.drag-item[data-id="1"] .button-modal-icon ion-icon,
.kpi-1 .button-modal-icon ion-icon {
    color: white !important;
}

/* Feedback percentuali */
.drag-item[data-id="1"] .up,
.drag-item[data-id="1"] .down,
.drag-item[data-id="1"] .neutral,
.kpi-1 .up,
.kpi-1 .down,
.kpi-1 .neutral {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Tab scrollabili per dashboard multiple */
.dashboard-tabs-wrapper {
    position: relative;
    overflow: hidden;
}

.dashboard-tabs-container {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    padding-bottom: 5px;
}

.dashboard-tabs-container::-webkit-scrollbar {
    height: 6px;
}

.dashboard-tabs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.dashboard-tabs-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.dashboard-tabs-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.nav-tabs {
    border-bottom: 1px solid #dee2e6;
    flex-wrap: nowrap !important;
    min-width: max-content;
}

.nav-tabs .nav-item {
    flex-shrink: 0;
    margin-bottom: -1px;
}

.nav-tabs .nav-link {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    min-width: max-content;
}

/* Indicatori di scroll */
.scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scroll-indicator:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.scroll-indicator.left {
    left: -15px;
}

.scroll-indicator.right {
    right: -15px;
}

.scroll-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}