body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5; /* Light mode default background */
    color: #333; /* Light mode default text color */
    transition: background-color 0.3s, color 0.3s;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a1a1a; /* Dark background */
    color: #e0e0e0; /* Light text */
}

body.dark-mode .timer-banner {
    background-color: #333;
    color: #f0f0f0;
}

body.dark-mode .chart-container {
    background-color: #444;
}

body.dark-mode .stats {
    background-color: #444;
}

/* --- Dark Mode for Email Generator Section --- */
body.dark-mode .email-generator-container {
    background: #2b2b2b; /* Darker background for the main content box */
    color: #e0e0e0;
}

body.dark-mode .email-generator-container h1 {
    color: #f0f0f0;
}

body.dark-mode label {
    color: #e0e0e0; /* Ensure labels are visible */
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #3e3e3e; /* Darker input background */
    color: #f0f0f0; /* Light text in inputs */
    border: 1px solid #555; /* Visible border */
}

body.dark-mode .additional-fields {
    background-color: #3e3e3e; /* Darker background for additional fields */
}

/* Dark Mode Toggle styling */
.dark-mode-toggle {
    display: flex;
    flex-direction: column; /* Stacks children vertically */
    align-items: center; /* Centers items horizontally within the column */
}
.dark-mode-toggle label {
    margin-bottom: 5px; /* Space between label and toggle */
    margin-right: 0; /* Override previous margin */
}

/* Timer Banner Layout */
.timer-banner {
    background-color: #2c3e50;
    color: white;
    padding: 10px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Distributes space between left and right sections */
    z-index: 1000;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    box-sizing: border-box; /* Ensures padding is included in width calculation */
}

.left-section, .right-section {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between items in these sections */
    flex-wrap: wrap; /* Allow items within sections to wrap as well */
}

.timer-container {
    display: flex;
    align-items: center;
}
.timer {
    font-size: 24px;
    font-weight: bold;
    margin: 0 15px;
}
button {
    padding: 8px 15px;
    margin: 0 5px;
    cursor: pointer;
}
.content {
    /* The margin-top is now set by JavaScript to be dynamic */
    padding: 20px;
}
.stats {
    padding: 5px 15px;
    background-color: #34495e;
    border-radius: 5px;
}
.chart-container {
    position: relative; /* Added for button positioning */
    width: 250px; /* Adjust width as needed */
    height: 100px; /* Adjust height as needed */
    background-color: #34495e;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease-in-out; /* Smooth transition for maximize */
}
/* Maximized Chart Styles */
.chart-container.maximized {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw; /* Full viewport width */
    height: 100vh; /* Full viewport height */
    z-index: 9999; /* Ensure it's on top of everything */
    background-color: rgba(0, 0, 0, 0.9); /* Semi-transparent dark overlay */
    padding: 20px;
    box-sizing: border-box;
    border-radius: 0; /* Remove border-radius when maximized */
    display: flex; /* Ensure content is centered when maximized */
    align-items: center;
    justify-content: center;
}
.chart-container.maximized canvas {
    width: 100% !important; /* Ensure canvas fills maximized container */
    height: 100% !important;
    max-width: 90vw; /* Add max-width/height to prevent overflow on very large screens */
    max-height: 90vh;
}

/* Email Template Generator specific styles */
.email-generator-container { 
    max-width: 800px;
    margin: 20px auto; 
    background: white;
    padding: 50px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
label {
    display: block;
    margin-top: 10px;
    margin-bottom: 5px;
    font-weight: bold;
}
input, select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
textarea {
    width: 100%;
    height: 400px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}
.email-generator-container button { 
    padding: 12px 20px;
    background: #3498db; /* UPDATED COLOR */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 5px 10px 0;
}
.email-generator-container button:hover {
    background: #2980b9; /* UPDATED COLOR */
}
.email-generator-container h1 {
    color: #232F3E;
    text-align: center;
}
.additional-fields {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: none;
}

/* Gamification Elements */
.achievement-container {
    max-width: 800px;
    margin: 20px auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

body.dark-mode .achievement-container {
    background-color: #2b2b2b;
    color: #e0e0e0;
}

.achievement-container h3 {
    margin-top: 0;
    color: #232F3E;
}

body.dark-mode .achievement-container h3 {
    color: #e0e0e0;
}

.badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}

.badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    opacity: 0.3;
    transition: all 0.3s ease;
    position: relative;
}

.badge.earned {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255,255,255,0.5);
}

.badge-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.badge:hover .badge-tooltip {
    opacity: 1;
}

.badge-speed {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
}

.badge-consistency {
    background: linear-gradient(135deg, #2196F3, #03A9F4);
}

.badge-efficiency {
    background: linear-gradient(135deg, #9C27B0, #673AB7);
}

.motivation-message {
    margin: 15px 0;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.motivation-good {
    background-color: #d4edda;
    color: #155724;
}

.motivation-warning {
    background-color: #fff3cd;
    color: #856404;
}

.motivation-danger {
    background-color: #f8d7da;
    color: #721c24;
}

body.dark-mode .motivation-good {
    background-color: #1e4620;
    color: #d4edda;
}

body.dark-mode .motivation-warning {
    background-color: #533f03;
    color: #fff3cd;
}

body.dark-mode .motivation-danger {
    background-color: #491217;
    color: #f8d7da;
}

.progress-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin: 15px 0;
    height: 20px;
    overflow: hidden;
}

body.dark-mode .progress-container {
    background-color: #4a5568;
}

.progress-bar {
    height: 100%;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    transition: width 0.5s ease;
}

.streak-counter {
    font-size: 18px;
    margin: 15px 0;
    font-weight: bold;
}

.tips-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #e8f4fd;
    border-left: 4px solid #3498db;
    border-radius: 4px;
    text-align: left;
}

body.dark-mode .tips-container {
    background-color: #2c3e50;
    border-left: 4px solid #3498db;
}

.tips-title {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 16px;
}

.tips-list {
    margin: 0;
    padding-left: 20px;
}

.tips-list li {
    margin-bottom: 5px;
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: fall 3s linear forwards;
    z-index: 9999;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Notification styles */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.5s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background-color: #28a745;
}

.notification-warning {
    background-color: #ffc107;
    color: #333;
}

.notification-danger {
    background-color: #dc3545;
}

/* Level indicator */
.level-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.level-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2196F3, #03A9F4); /* UPDATED COLOR */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.level-title {
    font-weight: bold;
    font-size: 16px;
}

