/* ==============================================================
   PANNELLO DESTRO UNIFICATO - Attività + Sensori Winet
   Sostituisce: .activity-panel-toggle, .activity-panel, .winet-panel-toggle, .winet-panel
   ============================================================== */

/* Toggle Buttons Container */
.right-panel-toggles {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    transition: right 0.3s ease;
}

/* No shift needed - panel floats over map */

.right-panel-toggle-btn {
    width: 50px;
    height: 50px;
    background: #233f64;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

.right-panel-toggle-btn:hover {
    background: #1a3050;
    transform: scale(1.08);
}

.right-panel-toggle-btn.active {
    background: #64ffda;
    color: #233f64;
    box-shadow: 0 2px 14px rgba(100,255,218,0.3);
}

/* Panel Container - centrato verticalmente */
.right-panel {
    position: absolute;
    top: 150px;
    right: 8px;
    bottom: 80px;
    width: 380px;
    background: #233f64;
    color: #fff;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.right-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* Header con Tabs */
.right-panel-header {
    padding: 0;
    background: #1a3050;
    border-bottom: 1px solid #3d5a80;
    display: flex;
    align-items: stretch;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.right-panel-tabs {
    display: flex;
    flex: 1;
}

.right-panel-tab {
    flex: 1;
    padding: 14px 12px;
    background: transparent;
    border: none;
    color: #8b9dc3;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.right-panel-tab:hover {
    color: #ccd6f6;
    background: rgba(255,255,255,0.03);
}

.right-panel-tab.active {
    color: #64ffda;
    border-bottom-color: #64ffda;
    background: rgba(100,255,218,0.05);
}

.right-panel-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0 14px;
    flex-shrink: 0;
}

.right-panel-close:hover {
    opacity: 1;
}

/* Tab Content */
.right-panel-body {
    flex: 1;
    overflow-y: auto;
    display: none;
}

.right-panel-body.active {
    display: flex;
    flex-direction: column;
}

/* Tab Attività - content (mantiene stili originali) */
#right-tab-activities {
    padding: 0;
}

#right-tab-activities .activity-project-selector {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

#right-tab-activities .activity-accordion-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 6px;
}

#right-tab-activities .activity-export-bar {
    flex-shrink: 0;
}

/* Tab Winet - content */
#right-tab-winet {
    padding: 12px;
}


/* ==============================================================
   WINET STYLES
   ============================================================== */

/* Empty State */
.winet-empty {
    text-align: center;
    padding: 30px 16px;
    color: #8b9dc3;
    font-size: 13px;
}

.winet-empty-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

/* Section Title */
.winet-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #64ffda;
    text-transform: uppercase;
    padding: 10px 0 6px 0;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    letter-spacing: 0.5px;
}

.winet-section {
    margin-bottom: 8px;
}

/* Connection List */
.winet-connection-item {
    background: #1a3050;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.winet-connection-item:hover {
    background: #152840;
}

.winet-connection-item.active {
    border-color: #64ffda;
}

.winet-conn-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.winet-conn-status { font-size: 10px; }

.winet-conn-label {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    flex: 1;
}

.winet-conn-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.winet-conn-badge.disabled {
    background: rgba(255,107,107,0.2);
    color: #ff6b6b;
}

.winet-conn-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #8b9dc3;
    margin-bottom: 6px;
}

.winet-conn-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Small Buttons */
.winet-btn-sm {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.winet-btn-sm:hover { background: rgba(100,255,218,0.2); }
.winet-btn-sm.danger:hover { background: rgba(255,107,107,0.3); }
.winet-btn-sm.off { opacity: 0.5; }

/* Network Items */
.winet-network-item {
    background: #1a3050;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.winet-network-item:hover {
    border-color: #64ffda;
    background: #152840;
}

.winet-net-name { font-weight: 600; font-size: 13px; color: #fff; }
.winet-net-desc { font-size: 11px; color: #8b9dc3; margin-top: 2px; }
.winet-net-meta { font-size: 10px; color: #64ffda; margin-top: 4px; }

/* Node Items */
.winet-node-item {
    background: #1a3050;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.winet-node-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.winet-node-icon { font-size: 14px; }

.winet-node-label {
    font-weight: 600;
    font-size: 12px;
    color: #fff;
    flex: 1;
}

.winet-node-sensors {
    font-size: 10px;
    color: #8b9dc3;
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Readings */
.winet-readings {
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 6px 8px;
}

.winet-reading-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.winet-reading-row:last-child { border-bottom: none; }
.winet-reading-label { flex: 1; color: #8b9dc3; }
.winet-reading-value { font-weight: 700; color: #64ffda; font-size: 12px; }
.winet-reading-time { font-size: 9px; color: #5a6b8a; }

/* ============================================================
   CHART - più grande
   ============================================================ */

.winet-chart-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.winet-chart-controls select {
    flex: 1;
    background: #1a3050;
    color: #fff;
    border: 1px solid #3d5a80;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    outline: none;
}

.winet-chart-controls select:focus { border-color: #64ffda; }

.winet-chart-container {
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 8px;
    height: 300px;
    min-height: 250px;
}

.winet-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Buttons */
.winet-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.winet-btn-add {
    background: rgba(100,255,218,0.1);
    color: #64ffda;
    border: 1px dashed #64ffda;
}

.winet-btn-add:hover { background: rgba(100,255,218,0.2); }

.winet-btn-primary {
    background: #64ffda;
    color: #233f64;
}

.winet-btn-primary:hover { background: #4de8c5; }

.winet-btn-cancel {
    background: transparent;
    color: #8b9dc3;
    border: 1px solid #3d5a80;
}

.winet-btn-cancel:hover { background: rgba(255,255,255,0.05); }

/* Form */
.winet-form { padding: 4px; }

.winet-form-group {
    margin-bottom: 12px;
}

.winet-form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #8b9dc3;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.winet-form-group input {
    width: 100%;
    background: #1a3050;
    color: #fff;
    border: 1px solid #3d5a80;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.winet-form-group input:focus { border-color: #64ffda; }

.winet-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.winet-form-actions .winet-btn { flex: 1; }


/* ==============================================================
   MOBILE RESPONSIVE
   ============================================================== */

@media (max-width: 768px) {
    .right-panel {
        width: calc(100% - 16px);
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 8px;
        height: 60vh;
        border-radius: 12px;
    }

    .right-panel-toggles {
        bottom: 80px;
        top: auto;
        right: 16px;
        transform: none;
    }
}
