:root {
    /* EnerStreet color palette based on the logo */
    --enerstreet-yellow: #ffdc00;
    --enerstreet-cyan: #00d4ff;
    --enerstreet-green: #5cd900;
    --enerstreet-blue: #004dff;
    --enerstreet-text: #121212;
    
    /* Modern color palette */
    --primary-color: var(--enerstreet-cyan);
    --primary-light: var(--enerstreet-cyan);
    --primary-dark: var(--enerstreet-blue);
    --secondary-color: var(--enerstreet-green);
    --secondary-light: var(--enerstreet-green);
    --accent-color: var(--enerstreet-yellow);
    --success-color: #38b000;
    --warning-color: #ffbe0b;
    --danger-color: #ff006e;
    --info-color: #3a86ff;
    
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, var(--enerstreet-cyan), var(--enerstreet-blue));
    --secondary-gradient: linear-gradient(135deg, var(--enerstreet-green), var(--enerstreet-cyan));
    --accent-gradient: linear-gradient(135deg, var(--enerstreet-yellow), var(--enerstreet-green));
    --enerstreet-gradient: linear-gradient(135deg, var(--enerstreet-yellow), var(--enerstreet-cyan), var(--enerstreet-green), var(--enerstreet-blue));
    --glass-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    
    /* Neutral colors */
    --dark-color: #1a1a2e;
    --gray-900: #212130;
    --gray-800: #303045;
    --gray-700: #484860;
    --gray-600: #5a5a72;
    --gray-500: #8e8ea0;
    --gray-400: #b5b5c3;
    --gray-300: #d1d1db;
    --gray-200: #e4e4e9;
    --gray-100: #f3f3f6;
    --light-color: #ffffff;
    
    /* Shadows and effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.16), 0 8px 16px rgba(0, 0, 0, 0.08);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-outline: 0 0 0 3px rgba(66, 153, 225, 0.5);
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Card properties */
    --card-radius: 16px;
    --card-padding: 20px;
    --card-padding-mobile: 16px;
    
    /* Animation */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes pulse {
    0% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.8; transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--gray-100);
    color: var(--dark-color);
    line-height: 1.6;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-md);
    width: 100%;
    min-height: 100vh;
    height: auto; /* Change from fixed height to auto to accommodate content */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Change from space-between to allow compression */
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    overflow-y: auto; /* Allow vertical scrolling if needed */
}

/* Background effects */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.shape-1 {
    top: -100px;
    right: -80px;
    width: 300px;
    height: 300px;
    background: var(--primary-light);
    animation: fadeIn 0.5s ease-out forwards;
}

.shape-2 {
    bottom: -150px;
    left: -100px;
    width: 350px;
    height: 350px;
    background: var(--secondary-light);
    animation: float 9s ease-in-out infinite reverse;
}

.shape-3 {
    top: 40%;
    left: 30%;
    width: 200px;
    height: 200px;
    background: var(--accent-color);
    animation: float 10s ease-in-out infinite 1s;
}

header {
    text-align: center;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 100px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding-left: var(--space-md);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 240px;
    height: 70px;
    margin: var(--space-md) 0;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.enerstreet-logo {
    background: transparent;
    position: relative;
    overflow: hidden;
}

.enerstreet-logo i {
    color: transparent;
}

h1 {
    color: var(--enerstreet-text);
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    margin: 0;
    font-family: 'Inter', sans-serif;
    text-transform: lowercase;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    width: 100%;
}

.card {
    background: var(--light-color);
    /* Remove border-radius from outer container to avoid conflict with inner elements */
    border-radius: 0;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    z-index: 1;
    border: 1px solid var(--gray-300);
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Modern card styles */
.modern-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modern-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.card-title {
    font-weight: 700;
    text-align: center;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--dark-color);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.card-body {
    padding: var(--card-padding);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Card type styles */
.total-card .card-body {
    background: var(--secondary-gradient);
    color: white;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.prev-month-card .card-body {
    background: var(--primary-gradient);
    color: white;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.current-card .card-body {
    background: var(--accent-gradient);
    color: white;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.date-card, .time-card {
    background-color: var(--light-color);
    color: var(--dark-color);
    position: relative;
    transform: perspective(1000px) rotateX(-2deg);
}

.date-card {
    transform: perspective(1000px) rotateX(-2deg) rotateY(-1deg);
}

.time-card {
    transform: perspective(1000px) rotateX(-2deg) rotateY(1deg);
}

.date-card::before, .time-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 0%, var(--primary-light) 100%);
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

.date-card .card-icon, .time-card .card-icon {
    background: rgba(var(--primary-color), 0.1);
    color: var(--primary-color);
}

.energy-card h2, .calculated-card h2 {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: var(--text-shadow);
    position: relative;
    z-index: 2;
}

.energy-card .unit, .calculated-card .unit {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.energy-card .card-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.calculated-card .card-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.production-card .card-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Graph button styles */
.graph-button-container {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.graph-button {
    background: var(--enerstreet-gradient);
    color: white;
    border: none;
    border-radius: var(--card-radius);
    padding: var(--space-md) var(--space-lg);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.graph-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.graph-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

h2 {
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.multiplier {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.2);
    margin-left: 4px;
    position: relative;
    z-index: 2;
    vertical-align: middle;
    backdrop-filter: blur(4px);
}

.value {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    text-shadow: var(--text-shadow);
    margin-bottom: 3px;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.value-date, .value-time {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 3px;
    padding: 8px 12px;
    background-color: var(--gray-100);
    border-radius: 12px;
    display: inline-block;
    position: relative;
    z-index: 2;
    box-shadow: var(--shadow-inner);
    letter-spacing: 1px;
}

.unit {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    margin-bottom: var(--space-sm);
}

.secondary-value {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 2;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 6px;
}

.label {
    font-size: 0.65rem;
    color: var(--gray-600);
    opacity: 0.8;
    margin-top: var(--space-xs);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
    font-style: italic;
}

footer {
    text-align: center;
    padding: var(--space-sm) 0;
    margin-top: auto;
}

/* Footer styles */
.footer-container {
    background-color: var(--light-color);
    border-radius: var(--card-radius);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.last-reading-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--enerstreet-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.last-reading-info {
    flex: 1;
}

.last-reading-label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
    color: var(--dark-color);
}

.last-reading-time {
    font-size: 0.75rem;
    color: var(--gray-600);
    opacity: 0.8;
}

.status-details {
    text-align: left;
    flex: 1;
}

.status {
    font-size: 0.8rem;
    margin-bottom: 2px;
    font-weight: 600;
    color: var(--gray-800);
}

.status.online {
    color: var(--success-color);
}

.status.offline {
    color: var(--danger-color);
}

#status-icon.online {
    background: var(--secondary-gradient);
}

#status-icon.offline {
    background: var(--accent-gradient);
}

.last-updated {
    font-size: 0.7rem;
    color: var(--gray-600);
    opacity: 0.9;
    font-style: italic;
}

/* Authentication styles */
.user-controls {
    display: flex;
    align-items: center;
}

.auth-container {
    position: relative;
    min-width: 250px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-form input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--dark-color);
}

.auth-form button,
.user-info button {
    padding: 0.5rem 1rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-form button:hover,
.user-info button:hover {
    background: var(--danger-color);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hidden {
    display: none;
}

/* Plant selector styles */
.plant-selector-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap; /* Allow wrapping on very small screens */
}

.plant-selector-container label {
    font-weight: 500;
    color: var(--dark-color);
}

.plant-selector-container select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--dark-color);
    cursor: pointer;
}

.plant-selector-container select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .value, .value-date, .value-time {
        font-size: 1.7rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 0.8rem;
        margin-bottom: var(--space-xs);
    }

    .card {
        padding: var(--card-padding-mobile);
    }

    .container {
        padding: var(--space-sm);
    }

    .dashboard {
        gap: var(--space-sm);
    }

    .cards-container {
        gap: var(--space-sm);
        margin-bottom: var(--space-sm);
    }

    .date-time-container {
        gap: var(--space-sm);
    }
    
    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-bottom: var(--space-xs);
    }
    
    .logo {
        width: 120px;
        height: 40px;
    }
    
    .logo img {
        min-width: 120px;
    }
    
    header {
        margin-bottom: var(--space-sm);
    }
    
    .status-container {
        padding: var(--space-sm);
    }
    
    .status-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

/* Additional styles for extra small screens like phones */
@media (max-width: 480px) {
    h1 {
        font-size: 1.3rem;
    }

    .value {
        font-size: 1.5rem;
    }

    .value-date, .value-time {
        font-size: 1.2rem;
        padding: 6px 8px;
    }

    .multiplier {
        font-size: 0.65rem;
        padding: 1px 4px;
    }

    .unit {
        font-size: 0.7rem;
    }

    .label {
        font-size: 0.6rem;
    }

    .status {
        font-size: 0.7rem;
    }
    
    .last-updated {
        font-size: 0.65rem;
    }

    footer {
        padding: var(--space-xs) 0;
    }
    
    .card-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    /* Improve plant selector for small screens */
    .plant-selector-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .plant-selector-container select {
        width: 100%;
    }
    
    /* Adjust graph button for small screens */
    .graph-button {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }
    
    /* Improve footer for small screens */
    .footer-container {
        padding: var(--space-sm);
    }
    
    .last-reading-label {
        font-size: 0.75rem;
    }
    
    .last-reading-time {
        font-size: 0.7rem;
    }
    
    /* Adjust 3D perspective for better mobile viewing */
    .energy-card, .calculated-card, .date-card, .time-card {
        transform: perspective(1000px) rotateX(1deg) rotateY(0deg);
    }
    
    /* Reduce shape size and blur for better performance */
    .shape {
        filter: blur(60px);
    }
    
    .shape-1 {
        width: 200px;
        height: 200px;
    }
    
    .shape-2 {
        width: 250px;
        height: 250px;
    }
    
    .shape-3 {
        width: 150px;
        height: 150px;
    }
}

/* Add a new media query for iPhone SE and similar smaller phones */
@media (max-width: 375px) and (max-height: 667px) {
    /* Specific optimizations for very small devices like iPhone SE */
    .container {
        padding: 6px;
    }
    
    /* Reduce margin between elements */
    .cards-container {
        gap: 10px;
        margin-bottom: 8px;
    }
    
    /* Make cards more compact */
    .modern-card {
        margin-bottom: 10px;
    }
    
    /* Reduce padding in card title */
    .card-title {
        font-size: 0.75rem;
        padding: 6px;
    }
    
    /* Reduce padding in card body */
    .card-body {
        padding: 12px;
    }
    
    /* Make button smaller */
    .graph-button-container {
        margin-bottom: 8px;
    }
    
    .graph-button {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* Reduce header and footer padding */
    header, footer {
        padding: 6px 0;
    }
    
    /* Adjust user controls */
    .user-controls {
        scale: 0.9;
    }
    
    /* Reduce plant selector size */
    .plant-selector-container {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    /* Make footer smaller */
    .footer-container {
        padding: 8px;
        margin-top: 4px;
    }
    
    /* Ensure there's no overflow */
    body, html {
        overflow-x: hidden;
    }
}

/* Orientation-specific adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: var(--space-xs);
    }
    
    header {
        padding: var(--space-xs) 0;
        margin-bottom: var(--space-xs);
    }
    
    .dashboard {
        gap: var(--space-xs);
        flex-direction: row;
    }

    .cards-container {
        gap: var(--space-xs);
        margin-bottom: 0;
        flex: 1;
    }

    .date-time-container {
        gap: var(--space-xs);
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .card {
        padding: var(--space-sm);
        min-height: 0;
    }

    h1 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    h2 {
        font-size: 0.7rem;
        margin-bottom: var(--space-xs);
    }

    .value, .value-date, .value-time {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }
    
    .unit {
        font-size: 0.65rem;
    }
    
    .label {
        font-size: 0.6rem;
        margin-top: 0;
    }
    
    footer {
        padding: var(--space-xs) 0;
    }
    
    .status-container {
        padding: var(--space-xs);
    }
    
    .status {
        font-size: 0.65rem;
        margin-bottom: 0;
    }
    
    .last-updated {
        font-size: 0.6rem;
    }
    
    .card-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        margin-bottom: var(--space-xs);
    }
    
    .logo {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    /* Remove 3D transforms in landscape to save space */
    .energy-card, .calculated-card, .date-card, .time-card {
        transform: none;
    }
    
    /* Hide shapes in landscape to improve performance */
    .shape {
        opacity: 0.2;
        filter: blur(50px);
    }
}

/* Very small phone screens */
@media (max-width: 360px) {
    :root {
        --card-padding-mobile: 10px;
    }
    
    .container {
        padding: var(--space-xs);
    }
    
    h1 {
        font-size: 1.1rem;
    }
    
    .value {
        font-size: 1.3rem;
    }
    
    .value-date, .value-time {
        font-size: 1.1rem;
        padding: 4px 6px;
    }
    
    .dashboard, .cards-container, .date-time-container {
        gap: var(--space-xs);
    }
    
    .card-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        margin-bottom: 4px;
    }
    
    .logo {
        width: 100px;
        height: 35px;
    }
    
    .logo img {
        min-width: 100px;
    }
    
    /* Adjust card content padding */
    .card-content {
        padding: 12px;
    }
    
    .card-header {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    /* Further reduce font sizes */
    .multiplier {
        font-size: 0.6rem;
    }
    
    .unit {
        font-size: 0.65rem;
    }
    
    /* Optimize header for very small screens */
    .logo-container {
        gap: 4px;
    }
    
    /* Adjust auth container */
    .auth-form input, .auth-form button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

/* Stili per la sezione grafici */
.charts-section {
    margin-top: 2rem;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    overflow: hidden;
}

.charts-container {
    width: 100%;
}

.charts-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.charts-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.charts-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.close-button {
    background: transparent;
    border: none;
    color: #777;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-button:hover {
    background-color: #f1f1f1;
    color: #333;
}

.charts-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.date-range, .interval-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-range input[type="date"], .interval-selector select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    color: #555;
    background-color: #f8f8f8;
}

.update-button {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.update-button:hover {
    background: linear-gradient(135deg, #388E3C, #2E7D32);
}

.chart-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.chart-tab {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px 5px 0 0;
    background-color: #f1f1f1;
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-tab.active {
    background-color: #4a6fa5;
    color: white;
}

.chart-container {
    height: 400px;
    margin-top: 1rem;
    width: 100%;
    position: relative;
}

/* Monthly Delta Table Styles */
.monthly-table-section {
    margin-top: 2rem;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    overflow: hidden;
    display: none; /* Hidden by default */
}

.monthly-table-container {
    width: 100%;
    margin-top: 1rem;
    overflow-x: auto;
}

.monthly-delta-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.9rem;
}

.monthly-delta-table th,
.monthly-delta-table td {
    padding: 0.8rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--gray-300);
}

.monthly-delta-table th:first-child,
.monthly-delta-table td:first-child {
    text-align: left;
}

.monthly-delta-table th {
    background-color: var(--gray-100);
    font-weight: 600;
    color: var(--gray-800);
    text-transform: uppercase;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.monthly-delta-table tbody tr:hover {
    background-color: var(--gray-100);
}

.monthly-table-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.monthly-table-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.monthly-table-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.monthly-table-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-selector label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.year-selector select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 5px;
    font-size: 0.9rem;
    color: var(--gray-700);
    background-color: var(--gray-100);
    cursor: pointer;
}

.monthly-table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1rem;
}

.monthly-table-actions button {
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.update-table-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
}

.close-table-btn {
    background-color: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.update-table-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.close-table-btn:hover {
    background-color: var(--gray-200);
    color: var(--gray-900);
}

@media (max-width: 768px) {
    .monthly-table-header {
        gap: 0.8rem;
    }
    
    .monthly-table-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    
    .monthly-table-controls {
        width: 100%;
    }
    
    .year-selector {
        width: 100%;
    }
    
    .year-selector select {
        flex: 1;
    }
    
    .monthly-delta-table th,
    .monthly-delta-table td {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Responsive adjustments per i grafici */
@media (max-width: 768px) {
    .charts-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .charts-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .date-range, .interval-selector {
        width: 100%;
    }
    
    .chart-tabs {
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        padding-bottom: 0.5rem;
    }
    
    .chart-container {
        height: 300px;
    }
}
