/**
 * FusionSolar Dashboard Pro - CSS
 * Design moderno e professionale per il dashboard fotovoltaico
 */

/* === RESET E BASE === */
.fusionsolar-pro-dashboard {
    max-width: 1400px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding: 0 20px;
}

.fusionsolar-pro-dashboard * {
    box-sizing: border-box;
}

/* === HEADER === */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.dashboard-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 5px 0;
}

.dashboard-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* === STATUS BADGE === */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-badge.status-online {
    background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
    color: white;
}

.status-badge.status-offline {
    background: linear-gradient(135deg, #ff4d4f 0%, #ff7875 100%);
    color: white;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === HERO KPI (Copertura Solare) === */
.hero-kpi {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    border-radius: 20px;
    padding: 40px;
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(255, 140, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.hero-kpi::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero-kpi-icon {
    font-size: 80px;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    z-index: 1;
}

.hero-kpi-content {
    flex: 1;
    z-index: 1;
}

.hero-kpi-label {
    font-size: 16px;
    font-weight: 600;
    color: rgba(0,0,0,0.7);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-kpi-value {
    font-size: 72px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-bottom: 10px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hero-kpi-unit {
    font-size: 48px;
    font-weight: 700;
    margin-left: 5px;
}

.hero-kpi-description {
    font-size: 18px;
    color: rgba(0,0,0,0.7);
    font-weight: 500;
}

/* Progress Circle */
.hero-kpi-sparkline {
    z-index: 1;
}

.progress-circle {
    width: 120px;
    height: 120px;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: rgba(255,255,255,0.3);
    stroke-width: 3;
}

.circle {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    animation: progress 2s ease-out forwards;
}

@keyframes progress {
    0% { stroke-dasharray: 0 100; }
}

/* === KPI GRID === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.kpi-icon {
    font-size: 48px;
    line-height: 1;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
}

.kpi-unit {
    font-size: 18px;
    font-weight: 500;
    color: #666;
    margin-left: 5px;
}

/* === IMPATTO DI OGGI === */
.impact-section {
    margin-bottom: 40px;
}

.impact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.impact-card {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
}

.impact-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.impact-card.impact-primary {
    background: linear-gradient(135deg, #5b68df 0%, #6d4ca0 100%);
    color: white;
    border: none;
    position: relative;
}

/* Overlay scuro per migliore contrasto */
.impact-card.impact-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    pointer-events: none;
}

.impact-card.impact-primary > * {
    position: relative;
    z-index: 1;
}

.impact-card.impact-primary .impact-title,
.impact-card.impact-primary .impact-factor {
    color: rgba(255,255,255,0.95);
}

.impact-card.impact-primary .impact-value {
    color: white;
}

.impact-timestamp {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.15);
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: lowercase;
}

.impact-icon {
    font-size: 44px;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.impact-content {
    width: 100%;
}

.impact-title {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    text-transform: none;
    line-height: 1.4;
}

.impact-value {
    font-size: 38px;
    font-weight: 700;
    color: #212529;
    line-height: 1.1;
    margin-bottom: 8px;
    white-space: nowrap;
}

.impact-factor-detail {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.impact-factor {
    font-size: 11px;
    color: #868e96;
    font-weight: 400;
    line-height: 1.3;
    font-style: italic;
}

/* Metodologia comprimibile */
.impact-methodology {
    background: rgba(102, 126, 234, 0.04);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

.impact-methodology summary {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.impact-methodology summary:hover {
    background: rgba(102, 126, 234, 0.08);
}

.impact-methodology summary::-webkit-details-marker {
    display: none;
}

.impact-methodology summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.impact-methodology[open] summary::before {
    transform: rotate(90deg);
}

.methodology-content {
    padding: 15px 18px;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
    font-size: 12px;
    color: #495057;
    line-height: 1.6;
}

.methodology-content p {
    margin: 0 0 10px 0;
}

.methodology-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.methodology-content li {
    margin-bottom: 5px;
}

/* === EQUIVALENZE === */
.equivalences-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.equivalences-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.equivalence-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: transform 0.3s ease;
}

.equivalence-card:hover {
    transform: scale(1.05);
}

.equivalence-icon {
    font-size: 56px;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.equivalence-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.equivalence-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* === ENVIRONMENTAL === */
.environmental-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.environmental-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.env-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.env-icon {
    font-size: 56px;
    margin-bottom: 15px;
}

.env-value {
    font-size: 48px;
    font-weight: 700;
    color: #2e7d32;
    line-height: 1;
    margin-bottom: 5px;
}

.env-unit {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.env-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.calculation-note {
    background: rgba(255,255,255,0.8);
    border-left: 4px solid #2e7d32;
    border-radius: 8px;
    padding: 15px;
    color: #333;
    line-height: 1.6;
}

/* === FOOTER === */
.dashboard-footer {
    background: #f5f5f5;
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-logo img {
    height: 40px;
    object-fit: contain;
}

.footer-text {
    display: flex;
    flex-direction: column;
}

.footer-text strong {
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.footer-text span {
    font-size: 12px;
    color: #666;
}

.footer-update {
    text-align: right;
}

.footer-update small {
    color: #666;
    font-size: 12px;
}

/* === NO DATA === */
.fusionsolar-pro-no-data {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
}

.no-data-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.fusionsolar-pro-no-data h3 {
    font-size: 24px;
    color: #856404;
    margin-bottom: 10px;
}

.fusionsolar-pro-no-data p {
    font-size: 16px;
    color: #856404;
    margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .kpi-grid,
    .impact-grid,
    .equivalences-grid,
    .environmental-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-kpi {
        padding: 30px;
    }
    
    .hero-kpi-value {
        font-size: 56px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .hero-kpi {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
    
    .hero-kpi-value {
        font-size: 48px;
    }
    
    .kpi-grid,
    .impact-grid,
    .equivalences-grid,
    .environmental-grid {
        grid-template-columns: 1fr;
    }
    
    /* KPI principale full-width e prima */
    .impact-grid {
        display: flex;
        flex-direction: column;
    }
    
    .impact-card.impact-primary {
        order: -1;
        padding: 40px 25px;
    }
    
    .impact-card {
        padding: 35px 25px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .footer-logo {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .dashboard-title {
        font-size: 24px;
    }
    
    .hero-kpi-value {
        font-size: 36px;
    }
    
    .hero-kpi-unit {
        font-size: 24px;
    }
    
    .kpi-value {
        font-size: 24px;
    }
    
    .impact-value {
        font-size: 28px;
    }
    
    .env-value {
        font-size: 36px;
    }
}

