:root {
    /* Color Palette - Dark Mode (Default) */
    --bg-body: #0f1115;
    --bg-card: #181b21;
    --bg-card-hover: #22262e;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-primary: #ff6b6b;
    /* Tomato Red */
    --accent-secondary: #4ecdc4;
    /* Teal */
    --accent-tertiary: #ffe66d;
    /* Yellow */

    --border-color: #2d3748;
    --glass-bg: rgba(24, 27, 33, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-md: 12px;
    --radius-lg: 16px;

    --font-sans: 'Inter', sans-serif;
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 16px 0;
}

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

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.date-display {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-card-hover);
}

/* Auth Styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.auth-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-primary);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.primary-btn-small {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 9999px; /* Pill shape */
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    vertical-align: middle;
    box-shadow: var(--shadow-sm);
}

.primary-btn-small:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.primary-btn-small:active {
    transform: translateY(0);
}

.auth-error {
    color: var(--accent-primary);
    font-size: 0.875rem;
    margin-bottom: 16px;
    text-align: center;
    min-height: 20px;
}

.auth-success {
    color: var(--accent-secondary);
    font-size: 0.875rem;
    margin-bottom: 16px;
    text-align: center;
    min-height: 20px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    gap: 24px;
}

/* Metrics Section */
.metrics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--glass-border);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.metric-icon {
    font-size: 1.25rem;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.metric-trend {
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: var(--accent-secondary);
}

.trend-down {
    color: var(--accent-primary);
}

.trend-neutral {
    color: var(--text-muted);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    height: 400px;
    display: flex;
    flex-direction: column;
}

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

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.chart-filter {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
    /* Important for Chart.js responsiveness in flex container */
}

/* Details Section */
.details-section {
    display: grid;
    grid-template-columns: 1fr;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent-secondary);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.875rem;
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-completed {
    background: rgba(78, 205, 196, 0.15);
    color: var(--accent-secondary);
}

.status-interrupted {
    background: rgba(255, 107, 107, 0.15);
    color: var(--accent-primary);
}

/* Profile Dropdown (GitHub Style) */
.profile-container {
    position: relative;
}

.profile-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-btn:hover,
.profile-btn:focus {
    border-color: var(--text-muted);
}

.avatar-placeholder {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), #ff8787);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.171);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    display: none;
    flex-direction: column;
    z-index: 100;
    transform-origin: top right;
    animation: scaleIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.dropdown-menu.show {
    display: flex;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name-display {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.user-email-display {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.dropdown-section {
    padding: 4px 8px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: background-color 0.15s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--accent-primary);
    /* Fallback or specific hover color */
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.item-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.dropdown-item:hover .item-icon {
    color: var(--text-primary);
}

.text-danger {
    color: #ff6b6b;
}

.dropdown-item.text-danger:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

.dropdown-item.text-danger .item-icon {
    color: #ff6b6b;
}