/* Motivate - Minimalist Health Tracking
   Kleurenschema: Energiek Groen */

:root {
    --primary: #10B981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --primary-bg: #f0fdf4;
    --text: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --radius: 16px;
    --radius-sm: 8px;
    --body-bg: linear-gradient(135deg, var(--primary-bg) 0%, var(--primary-light) 100%);
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #34d399;
    --primary-dark: #10B981;
    --primary-light: #064e3b;
    --primary-bg: #0f1f1a;
    --text: #f3f4f6;
    --text-light: #9ca3af;
    --white: #1f2937;
    --gray-100: #374151;
    --gray-200: #4b5563;
    --gray-300: #6b7280;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --body-bg: linear-gradient(135deg, #0a1612 0%, #0f1f1a 100%);
}

/* Auto dark mode (system preference) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --primary: #34d399;
        --primary-dark: #10B981;
        --primary-light: #064e3b;
        --primary-bg: #0f1f1a;
        --text: #f3f4f6;
        --text-light: #9ca3af;
        --white: #1f2937;
        --gray-100: #374151;
        --gray-200: #4b5563;
        --gray-300: #6b7280;
        --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
        --body-bg: linear-gradient(135deg, #0a1612 0%, #0f1f1a 100%);
    }
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--body-bg);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    line-height: 1.5;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-logo {
    font-size: 48px;
    text-align: center;
    margin-bottom: 8px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 15px;
}

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

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

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.login-error.show {
    display: block;
}

/* ===== DASHBOARD ===== */
.dashboard {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    position: relative;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.header-logo span {
    font-size: 28px;
}

.header-datetime {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

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

.btn-logout {
    padding: 8px 16px;
    font-size: 14px;
    background: var(--gray-100);
    color: var(--text-light);
    width: 100%;
}

.btn-logout:hover {
    background: var(--gray-200);
}

/* ===== MAIN GRID ===== */
.main {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* ===== USER COLUMN ===== */
.user-column {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.user-header {
    background: var(--primary);
    color: var(--white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-header-name {
    font-size: 20px;
    font-weight: 700;
}

.user-header-xp {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.user-header-xp .xp-icon {
    color: #fcd34d;
}

.user-header-xp.earned {
    animation: xp-pop 0.3s ease;
}

.user-activities {
    padding: 12px;
    background: var(--gray-100);
}

/* ===== ACTIVITY CARD (Compact Design) ===== */
.activity {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.activity:last-child {
    margin-bottom: 0;
}

/* Emoji Icon in Circle */
.activity-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon {
    font-size: 24px;
}

/* Activity Content */
.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.activity-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.activity-count.completed {
    color: var(--primary-dark);
}

.activity-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Compact Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-fill.completed {
    background: linear-gradient(90deg, var(--primary-dark) 0%, #047857 100%);
}

/* XP Badge */
.activity-xp {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
    flex-shrink: 0;
    margin-right: 8px;
}

.activity-xp .xp-icon {
    font-size: 12px;
}

/* Action Buttons */
.activity-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-action {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--white);
    font-size: 20px;
    font-weight: 400;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-user-select: none;
    user-select: none;
}

.btn-subtract {
    width: 32px;
    height: 32px;
    font-size: 16px;
    background: var(--gray-200);
    color: var(--text-light);
    border-radius: 8px;
}

.btn-subtract:hover {
    background: var(--gray-300);
}

.btn-add {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-add:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-action:active {
    transform: scale(0.95);
}

.btn-action.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-add.completed {
    background: var(--primary-dark);
}

.btn-add.completed span {
    display: none;
}

.btn-add.completed::after {
    content: "✓";
    font-size: 18px;
}

/* Pulse animation on tap */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.btn-action.pulse {
    animation: pulse 0.2s ease;
}

/* XP Earned Animation */
@keyframes xp-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #f59e0b; }
    100% { transform: scale(1); }
}

.activity-xp.earned {
    animation: xp-pop 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .main {
        padding: 16px;
    }

    .header {
        padding: 12px 16px;
    }

    .header-logo {
        font-size: 18px;
    }

    .header-datetime {
        font-size: 13px;
    }

    .user-header {
        padding: 16px 20px;
        font-size: 20px;
    }

    .activity {
        padding: 16px;
    }

    .activity-name {
        font-size: 16px;
    }

    .btn-add {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
}

/* iPad landscape optimization */
@media (min-width: 1024px) and (max-width: 1366px) {
    .main {
        padding: 32px;
    }

    .activity {
        padding: 24px;
    }

    .btn-add {
        width: 72px;
        height: 72px;
        font-size: 36px;
    }
}

/* ===== CONFETTI CANVAS ===== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ===== LOADING STATE ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TIMER ===== */
.btn-timer {
    padding: 8px 16px;
    font-size: 14px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-timer:hover {
    background: var(--primary-dark);
}

.btn-timer .icon {
    font-size: 16px;
}

/* Timer Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--gray-200);
}

/* Timer Display */
.timer-display {
    text-align: center;
    margin-bottom: 24px;
}

.timer-time {
    font-size: 64px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.timer-time.running {
    color: var(--primary);
}

.timer-time.finished {
    color: #ef4444;
    animation: pulse-color 0.5s infinite;
}

@keyframes pulse-color {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Timer Presets */
.timer-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.timer-preset {
    padding: 12px 8px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all 0.2s;
}

.timer-preset:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.timer-preset.active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

/* Custom Time Input */
.timer-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-input {
    width: 70px;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

.timer-input:focus {
    outline: none;
    border-color: var(--primary);
}

.timer-input-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
}

.timer-input-separator {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

/* Sound Select */
.timer-sound {
    margin-bottom: 24px;
}

.timer-sound-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 12px;
    display: block;
    text-align: center;
}

.timer-sound-options {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.timer-sound-option {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: var(--white);
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.timer-sound-option:hover {
    border-color: var(--primary);
}

.timer-sound-option.active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

/* Timer Controls */
.timer-controls {
    display: flex;
    gap: 12px;
}

.timer-controls .btn {
    flex: 1;
}

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

.btn-start:hover {
    background: var(--primary-dark);
}

.btn-stop {
    background: #ef4444;
    color: var(--white);
}

.btn-stop:hover {
    background: #dc2626;
}

.btn-reset {
    background: var(--gray-200);
    color: var(--text);
}

.btn-reset:hover {
    background: var(--gray-300);
}

/* Timer Dashboard Indicator */
.timer-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--white);
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 500;
}

.timer-indicator.show {
    transform: translateY(0);
    opacity: 1;
}

.timer-indicator:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.timer-indicator-icon {
    font-size: 20px;
}

.timer-indicator-time {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}

.timer-indicator.alarming {
    background: #ef4444;
    animation: indicator-pulse 0.5s infinite;
}

.timer-indicator.alarming .timer-indicator-time {
    color: var(--white);
}

.timer-indicator.alarming .timer-indicator-icon {
    filter: grayscale(1) brightness(10);
}

@keyframes indicator-pulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(0) scale(1.05); }
}

.timer-indicator-stop {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--white);
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.timer-indicator-stop:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Play/Pause button */
.timer-indicator-play {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--primary);
    border-radius: 50%;
    color: var(--white);
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    transition: background 0.2s;
}

.timer-indicator-play:hover {
    background: var(--primary-dark);
}

/* Close button */
.timer-indicator-close {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-300);
    border-radius: 50%;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    transition: background 0.2s;
}

.timer-indicator-close:hover {
    background: #ef4444;
    color: white;
}

/* Paused state */
.timer-indicator.paused {
    background: var(--gray-200);
}

.timer-indicator.paused .timer-indicator-time {
    color: var(--text-light);
}

.timer-indicator.paused .timer-indicator-play {
    background: var(--primary);
}

/* Mobile adjustments for indicator */
@media (max-width: 768px) {
    .timer-indicator {
        bottom: 16px;
        right: 16px;
        padding: 10px 16px;
    }

    .timer-indicator-time {
        font-size: 20px;
    }
}

/* ===== SETTINGS ===== */
.btn-settings {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--gray-100);
    color: var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-settings:hover {
    background: var(--gray-200);
}

.btn-settings .icon {
    font-size: 20px;
}

/* Settings Modal */
.settings-modal {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.settings-section-desc {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.settings-footer .btn {
    width: auto;
    min-width: 150px;
}

/* Activities List */
.activities-list {
    margin-bottom: 16px;
}

.activity-settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all 0.2s;
}

.activity-settings-item:last-child {
    margin-bottom: 0;
}

.activity-settings-item:hover {
    background: var(--gray-200);
}

.activity-settings-item.dragging {
    opacity: 0.5;
    background: var(--primary-light);
}

/* Drag Handle */
.activity-drag-handle {
    cursor: grab;
    color: var(--text-light);
    font-size: 16px;
    letter-spacing: -2px;
    padding: 4px;
    user-select: none;
}

.activity-drag-handle:active {
    cursor: grabbing;
}

.activity-settings-icon {
    width: 40px;
    height: 40px;
    background: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.activity-settings-info {
    flex: 1;
    min-width: 0;
}

.activity-settings-name {
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}

.activity-settings-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* Toggle Switches */
.activity-settings-toggles {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.toggle-name {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
    min-width: 50px;
}

.toggle-input {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--gray-300);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-switch {
    background: var(--primary);
}

.toggle-input:checked + .toggle-switch::after {
    transform: translateX(16px);
}

/* User Activity Setting (toggle + goal input) */
.user-activity-setting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.goal-input-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 1;
    transition: opacity 0.2s;
}

.goal-input-wrapper.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.goal-input {
    width: 42px;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    background: var(--white);
    color: var(--text);
    -moz-appearance: textfield;
}

.goal-input::-webkit-outer-spin-button,
.goal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.goal-input:focus {
    outline: none;
    border-color: var(--primary);
}

.goal-input.custom {
    border-color: var(--primary);
    background: var(--primary-light);
}

.goal-suffix {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
}

/* Activity Actions */
.activity-settings-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--gray-200);
}

.btn-edit:hover {
    background: #dbeafe;
}

.btn-delete:hover {
    background: #fee2e2;
}

/* Add Activity Button */
.btn-add-activity {
    width: 100%;
    padding: 12px;
    background: var(--white);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-activity:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

/* Add Activity Modal */
.add-activity-modal {
    max-width: 400px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.emoji-input {
    font-size: 32px;
    text-align: center;
    padding: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions .btn {
    flex: 1;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* Empty & Error States */
.empty, .error {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
    font-size: 14px;
}

.error {
    color: #ef4444;
}

/* Mobile Settings */
@media (max-width: 768px) {
    .settings-modal {
        width: 95%;
        max-height: 85vh;
        padding: 20px;
    }

    .activity-settings-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .activity-settings-toggles {
        width: 100%;
        justify-content: flex-start;
        padding-left: 52px;
        margin-top: 8px;
    }

    .activity-settings-actions {
        position: absolute;
        right: 12px;
        top: 12px;
    }

    .activity-settings-item {
        position: relative;
        padding-right: 80px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== THEME SELECTOR ===== */
.theme-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.theme-options {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    background: var(--gray-200);
}

.theme-option.active {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.theme-option-icon {
    font-size: 24px;
    line-height: 1;
}

.theme-option-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.theme-option.active .theme-option-label {
    color: var(--primary-dark);
}

/* Mobile theme options */
@media (max-width: 480px) {
    .theme-options {
        flex-direction: column;
    }

    .theme-option {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
    }
}

/* ===== ACCOUNT SECTION ===== */
.account-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.account-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.account-label {
    font-size: 14px;
    color: var(--text-light);
}

.account-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* ===== NOTIFICATIONS SECTION ===== */
.notifications-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.notification-toggle-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-toggle-label:hover {
    background: var(--gray-200);
}

.notification-toggle-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.notification-toggle-icon {
    font-size: 20px;
}

.notification-toggle-hint {
    font-size: 12px;
    color: var(--text-light);
    padding-left: 4px;
    min-height: 18px;
}

.notification-toggle-hint.error {
    color: #ef4444;
}

/* ===== STREAKS ===== */
.streak-badge {
    font-size: 12px;
    color: #f97316;
    margin-left: 6px;
    font-weight: 600;
}

.perfect-streak {
    font-size: 14px;
    color: #f97316;
    margin-left: 8px;
    font-weight: 600;
}

.perfect-streak:empty {
    display: none;
}

/* ===== STATISTICS ===== */

/* Statistics Button in Header */
.btn-stats {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--gray-100);
    color: var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-stats:hover {
    background: var(--gray-200);
}

.btn-stats .icon {
    font-size: 20px;
}

/* Statistics Modal - wider for comparison view */
.statistics-modal {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

/* Stats Sections */
.stats-section {
    margin-bottom: 24px;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Comparison Layout - Two columns */
.stats-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stats-user-column {
    min-width: 0;
}

.stats-user-name {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    color: var(--primary);
}

/* XP Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-card {
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

/* Streaks Comparison */
.stats-streaks-compare {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.streak-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streak-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    min-width: 70px;
}

.streak-fire {
    font-size: 20px;
}

.streak-current {
    font-size: 24px;
    font-weight: 700;
    color: #f97316;
}

.streak-best {
    font-size: 12px;
    color: var(--text-light);
    margin-left: auto;
}

/* Chart Header with Navigation and Period Toggle */
.stats-chart-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.stats-chart-header .stats-section-title {
    flex: 1;
    text-align: center;
    margin-bottom: 0;
}

/* Navigation Buttons */
.nav-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
    background: var(--gray-200);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Period Toggles */
.period-toggles {
    display: flex;
    gap: 4px;
}

.period-toggle {
    padding: 6px 12px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.period-toggle:hover {
    background: var(--gray-200);
}

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

/* CSS-only Bar Chart */
.stats-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    padding: 16px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    gap: 4px;
}

.stats-chart-month {
    gap: 2px;
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

/* Bar group for comparison (two bars per day) */
.chart-bar-group {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 100%;
    width: 100%;
    justify-content: center;
}

.chart-bar {
    width: 10px;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}

/* User colors for comparison */
.chart-bar.user-1 {
    background: linear-gradient(to top, var(--primary), var(--primary-dark));
}

.chart-bar.user-2 {
    background: linear-gradient(to top, #10b981, #059669);
}

.stats-chart-month .chart-bar {
    width: 6px;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-label {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 500;
    min-height: 14px;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text);
}

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

.legend-color.user-1 {
    background: var(--primary);
}

.legend-color.user-2 {
    background: #10b981;
}

/* Activities List */
.stats-activities-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-activity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.stats-activity-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.stats-activity-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-activity-rate {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.stats-activity-streak {
    font-size: 11px;
    color: #f97316;
    font-weight: 600;
}

/* Error & Empty States */
.stats-error {
    text-align: center;
    color: var(--text-light);
    padding: 24px;
}

.stats-empty {
    text-align: center;
    color: var(--text-light);
    padding: 12px;
    font-size: 13px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .statistics-modal {
        width: 95%;
        max-height: 85vh;
        padding: 16px;
    }

    /* Stack columns on mobile */
    .stats-compare {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-user-name {
        padding-bottom: 8px;
        border-bottom: 1px solid var(--gray-200);
    }

    .stats-grid {
        gap: 6px;
    }

    .stat-card {
        padding: 10px 6px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stats-chart {
        height: 100px;
        padding: 12px;
    }

    .chart-bar {
        width: 8px;
    }

    .stats-chart-month .chart-bar {
        width: 4px;
    }

    .chart-label {
        font-size: 9px;
    }

    .streak-current {
        font-size: 20px;
    }

    .streak-fire {
        font-size: 18px;
    }

    .stats-activity-item {
        padding: 6px;
    }

    .stats-activity-name {
        font-size: 12px;
    }
}

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
    max-width: 320px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

/* Toast Types */
.toast-milestone {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
}

.toast-encouragement,
.toast-streak {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-left: 4px solid var(--primary);
}

.toast-almost_done {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #3b82f6;
}

/* Dark mode toasts */
[data-theme="dark"] .toast {
    background: var(--white);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .toast-milestone {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
}

[data-theme="dark"] .toast-encouragement,
[data-theme="dark"] .toast-streak {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
}

[data-theme="dark"] .toast-almost_done {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
}

[data-theme="dark"] .toast-message {
    color: var(--text);
}

/* Auto dark mode toasts (system preference) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) .toast {
        background: #1f2937;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    :root:not([data-theme="light"]):not([data-theme="dark"]) .toast-milestone {
        background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    }
    :root:not([data-theme="light"]):not([data-theme="dark"]) .toast-encouragement,
    :root:not([data-theme="light"]):not([data-theme="dark"]) .toast-streak {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    }
    :root:not([data-theme="light"]):not([data-theme="dark"]) .toast-almost_done {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
    }
    :root:not([data-theme="light"]):not([data-theme="dark"]) .toast-message {
        color: #f3f4f6;
    }
}

/* Mobile: toast aan onderkant */
@media (max-width: 480px) {
    #toast-container {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
    }

    .toast {
        transform: translateY(100px);
        max-width: none;
    }

    .toast.show {
        transform: translateY(0);
    }
}
