/* Emission Analytics Specific Styles */

:root {
    --primary-color: #e67e22;
    --primary-dark: #d35400;
    --primary-light: #f39c12;
    --secondary-color: #7f8c8d;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Analytics Hero Section */
.analytics-hero {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 40px 0;
    position: relative;
    overflow: hidden;
}

.analytics-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="rgba(255,255,255,0.03)"><polygon points="50,0 100,50 50,100 0,50"/></svg>');
    background-size: 80px 80px;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero-text p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    opacity: 0.9;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0;
}

/* Main Content */
.analytics-main {
    background: var(--light-bg);
    padding: 40px 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Time Selector */
.time-selector {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.time-selector h3 {
    margin-bottom: 15px;
    color: var(--primary-dark);
}

.period-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.period-btn {
    padding: 10px 20px;
    border: 2px solid #e9ecef;
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.period-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.period-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-input {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* KPI Section */
.kpi-section {
    margin-bottom: 40px;
}

.kpi-section h2 {
    color: var(--primary-dark);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.kpi-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.kpi-header h4 {
    color: var(--primary-dark);
    margin: 0;
    font-size: 1.1rem;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.kpi-unit {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.kpi-trend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 500;
}

.kpi-trend.positive {
    color: var(--success-color);
}

.kpi-trend.negative {
    color: var(--error-color);
}

/* Charts Section */
.charts-section {
    margin-bottom: 40px;
}

.chart-row {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-row:first-child {
    grid-template-columns: 1fr;
}

.chart-row:nth-child(2),
.chart-row:nth-child(3) {
    grid-template-columns: 1fr 1fr;
}

.chart-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.chart-card.large {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-header h4 {
    color: var(--primary-dark);
    margin: 0;
    font-size: 1.2rem;
}

.chart-legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.scope1 { background: #e74c3c; }
.legend-color.scope2 { background: #3498db; }
.legend-color.scope3 { background: #f39c12; }

.chart-container {
    height: 300px;
    position: relative;
}

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

/* Insights Section */
.insights-section {
    margin-bottom: 40px;
}

.insights-section h2 {
    color: var(--primary-dark);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.insight-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-bg);
}

.insight-header i {
    font-size: 1.3rem;
}

.insight-header i.warning { color: var(--warning-color); }
.insight-header i.success { color: var(--success-color); }
.insight-header i.primary { color: var(--primary-color); }

.insight-header h4 {
    color: var(--primary-dark);
    margin: 0;
    font-size: 1.1rem;
}

.insight-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
    transition: var(--transition);
}

.insight-item:hover {
    background: #e9ecef;
}

.site-name, .opportunity {
    font-weight: 500;
    color: var(--primary-dark);
}

.emission-value, .savings, .performance {
    font-size: 0.9rem;
    font-weight: 600;
}

.emission-value { color: var(--error-color); }
.savings { color: var(--success-color); }
.performance { color: var(--success-color); }

/* Export Section */
.export-section {
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
}

.export-header h3 {
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.export-header p {
    color: var(--secondary-color);
    margin-bottom: 25px;
}

.export-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--light-bg);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.export-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

/* Button Styles */
.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

/* Responsive Design */
@media screen and (max-width: 968px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .hero-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .chart-row:nth-child(2),
    .chart-row:nth-child(3) {
        grid-template-columns: 1fr;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
    }
    
    .period-buttons {
        flex-direction: column;
    }
    
    .period-btn {
        text-align: center;
    }
    
    .export-options {
        flex-direction: column;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-legend {
        justify-content: flex-start;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .date-range {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input {
        width: 100%;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation for data refresh */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.refreshing {
    animation: pulse 1s ease-in-out;
}

/* Additional chart styles */
.legend-color.electricity { background: #9b59b6; }
.legend-color.renewable { background: #2ecc71; }
.legend-color.heating { background: #e67e22; }
.legend-color.grid { background: #34495e; }
.legend-color.solar { background: #f1c40f; }
.legend-color.wind { background: #3498db; }
.legend-color.hydro { background: #1abc9c; }

/* Chart tooltip enhancements */
.chart-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Additional insight colors */
.insight-header i.info { color: #3498db; }

/* Ensure proper spacing for analytics page */
.analytics-main {
    margin-top: 0;
}

/* Fix any potential conflicts with main styles */
.analytics-hero {
    margin-top: 0 !important;
}