/**
 * Main Stylesheet for Sirdal Solar Dashboard
 * Separated from HTML for flexibility and maintainability
 *
 * This file contains:
 * - Typography
 * - Layout (Grid, Flexbox)
 * - Component styles
 * - Animations
 *
 * Color variables are imported from palette files.
 * To switch palettes, change the @import statement below.
 */

/* ============================================
   IMPORT COLOR PALETTE
   Switch between palettes by changing the import
   ============================================ */

/* CURRENT PALETTE - Choose one: */
/* @import url('palette-nordic-solar.css'); */
/* @import url('palette-energy-optimist.css'); */
/* @import url('palette-sustainable-elegance.css'); */

/*
   Color variables are now imported from palette files.
   This file only contains layout and component styles.
   The palette CSS files define all colors.
*/

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans, 'Inter', sans-serif);
    background: var(--bg-page, var(--neutral-50, #f8f9fa));
    color: var(--text-primary, var(--neutral-800, #212529));
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ============================================
   LAYOUT - MAIN GRID
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: 80px 1fr;
    height: 100vh;
    width: 100vw;
    gap: 0;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    grid-column: 1 / -1;
    background: var(--bg-header);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    box-shadow: var(--shadow-green, 0 4px 12px rgba(30, 125, 30, 0.3));
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-placeholder {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sirdal-logo {
    width: 60px;
    height: 60px;
    border-radius: 0px;
    object-fit: contain;
}

.plant-name {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ============================================
   MAIN CONTENT - CHARTS COLUMN
   ============================================ */

.charts-column {
    background: var(--bg-page, var(--neutral-50, #f8f9fa));
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
}

.chart-card {
    background: var(--bg-card, #FFFFFF);
    border-radius: 0px;
    padding: 1.25rem;
    box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,0.12));
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chart-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

/* Chart Heights */
.chart-card.daily {
    flex: 1;
}

.chart-card.weekly {
    flex: 0.75;
}

.chart-card.monthly {
    flex: 0.6;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    background: var(--bg-page, var(--neutral-50, #f8f9fa));
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

/* ============================================
   KPI CARDS
   ============================================ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.kpi-card {
    background: var(--bg-card, #FFFFFF);
    border-radius: 0px;
    padding: 0.875rem;
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,0.1));
    border-left: 4px solid var(--accent-500, #2a9fd1);
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.1));
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--secondary-500, #f8a700);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.kpi-unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   FUN FACTS SECTION
   ============================================ */

.fun-facts {
    background: var(--primary-600, #1e7d1e);
    border-radius: 0px;
    padding: 1.75rem;
    box-shadow: var(--shadow-green, 0 2px 8px rgba(30, 125, 30, 0.3));
    border: 2px solid var(--primary-700, #125012);
    margin-top: 0.5rem;
}

.fun-facts-title {
    font-size: 1.225rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fun-facts-icon {
    font-size: 1.75rem;
}

.fun-facts-text {
    font-size: 1.225rem;
    line-height: 1.5;
    color: #FFFFFF;
}

/* ============================================
   LOGO FOOTER
   ============================================ */

.logo-footer {
    background: transparent;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
}

.logo-footer-image,
.logo-image {
    width: 100%;
    max-width: 280px;
    height: auto;
}

.logo-footer-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Mobile Base Styles (<768px) - Default is mobile-first */
@media (max-width: 767px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }

    .dashboard-grid {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        width: 100%;
    }

    /* Header - Mobile */
    .header {
        padding: 0.75rem 1rem;
        height: auto;
        min-height: 60px;
    }

    .logo-section {
        gap: 0.5rem;
    }

    .sirdal-logo {
        width: 40px;
        height: 40px;
    }

    .plant-name {
        font-size: 1.125rem;
        line-height: 1.2;
    }

    /* Charts Column - Mobile (stacked vertically) */
    .charts-column {
        padding: 1rem;
        gap: 0.75rem;
        overflow: visible;
    }

    .chart-card {
        min-height: 250px;
        flex: none !important;
        padding: 1rem;
    }

    .chart-card.daily,
    .chart-card.weekly,
    .chart-card.monthly {
        min-height: 250px;
        flex: none;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chart-title {
        font-size: 1rem;
    }

    .chart-subtitle {
        font-size: 0.8125rem;
    }

    /* Sidebar - Mobile (below charts, full width) */
    .sidebar {
        width: 100%;
        padding: 1rem;
        gap: 0.75rem;
        overflow-y: visible;
    }

    /* KPI Grid - Mobile (single column) */
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    .kpi-card {
        padding: 0.75rem;
    }

    .kpi-label {
        font-size: 0.6875rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .kpi-unit {
        font-size: 0.6875rem;
    }

    /* Fun Facts - Mobile */
    .fun-facts {
        padding: 1.25rem;
        margin-top: 0;
    }

    .fun-facts-title {
        font-size: 1rem;
    }

    .fun-facts-text {
        font-size: 1rem;
    }

    /* Logo Footer - Mobile */
    .logo-footer {
        padding: 0.75rem;
    }

    .logo-footer-image,
    .logo-image {
        max-width: 200px;
    }
}

/* Tablet Styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .dashboard-grid {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    /* Header - Tablet */
    .header {
        padding: 1rem 1.5rem;
    }

    .plant-name {
        font-size: 1.5rem;
    }

    /* Charts - Tablet (taller than mobile) */
    .charts-column {
        padding: 1.25rem;
    }

    .chart-card {
        min-height: 300px;
        flex: none !important;
    }

    .chart-card.daily,
    .chart-card.weekly,
    .chart-card.monthly {
        min-height: 300px;
        flex: none;
    }

    /* Sidebar - Tablet (below charts) */
    .sidebar {
        width: 100%;
        padding: 1.25rem;
    }

    /* KPI Grid - Tablet (2 columns) */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .logo-footer-image,
    .logo-image {
        max-width: 240px;
    }
}

/* Desktop Styles (1024px - 1279px) - Restore original layout */
@media (min-width: 1024px) {
    body {
        overflow: hidden;
        height: 100vh;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr 360px;
        grid-template-rows: 80px 1fr;
        height: 100vh;
        width: 100vw;
        gap: 0;
    }

    .header {
        grid-column: 1 / -1;
        padding: 0 2rem;
    }

    .plant-name {
        font-size: 2rem;
    }

    .charts-column {
        padding: 1.5rem;
        overflow: hidden;
    }

    /* Restore flex ratios for desktop */
    .chart-card.daily {
        flex: 1 !important;
        min-height: 0;
    }

    .chart-card.weekly {
        flex: 0.75 !important;
        min-height: 0;
    }

    .chart-card.monthly {
        flex: 0.6 !important;
        min-height: 0;
    }

    .sidebar {
        width: auto;
        padding: 1.5rem;
        overflow-y: auto;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Desktop (1280px - 1919px) */
@media (min-width: 1280px) and (max-width: 1919px) {
    .dashboard-grid {
        grid-template-columns: 1fr 380px;
    }
}

/* Extra Large Desktop (1920px+) */
@media (min-width: 1920px) {
    .dashboard-grid {
        grid-template-columns: 1fr 380px;
    }
}

/* ============================================
   CHART.JS CUSTOM STYLING
   ============================================ */

canvas {
    max-height: 100% !important;
}
