/* CSS Variables for Theming - Flat Color Scheme: Black, White, Grey, Blue */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --text-primary: #000000;
    --text-secondary: #808080;
    --accent-easy: #0066ff;
    --accent-medium: #0066ff;
    --accent-hard: #0066ff;
    --border-color: #808080;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.2);
    --xp-bar: #0066ff;
    --success: #0066ff;
    --blue: #0066ff;
    --grey: #808080;
    --black: #000000;
    --white: #ffffff;
}

[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --text-primary: #ffffff;
    --text-secondary: #808080;
    --accent-easy: #0066ff;
    --accent-medium: #0066ff;
    --accent-hard: #0066ff;
    --border-color: #808080;
    --shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
    --shadow-hover: 0 4px 12px rgba(255, 255, 255, 0.15);
    --xp-bar: #0066ff;
    --success: #0066ff;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.header-content {
    flex: 1;
}

.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* XP Progress Bar */
.xp-progress-container {
    margin-bottom: 30px;
}

.xp-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.xp-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.xp-progress-fill {
    height: 100%;
    background: var(--blue);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
}

.xp-progress-fill.level-up {
    animation: levelUpPulse 0.8s ease;
}

@keyframes levelUpPulse {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(1.02); }
}

/* Task Form */
.task-form-container {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.task-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.task-input:focus {
    outline: none;
    border-color: var(--xp-bar);
}

.task-description {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.task-description:focus {
    outline: none;
    border-color: var(--xp-bar);
}

.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.difficulty-selector label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.difficulty-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.difficulty-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.difficulty-btn.active {
    border-color: var(--black);
    background: var(--blue);
    color: var(--white);
}

.difficulty-btn[data-difficulty="easy"].active {
    background: var(--blue);
    border-color: var(--black);
    color: var(--white);
}

.difficulty-btn[data-difficulty="medium"].active {
    background: var(--blue);
    border-color: var(--black);
    color: var(--white);
}

.difficulty-btn[data-difficulty="hard"].active {
    background: var(--blue);
    border-color: var(--black);
    color: var(--white);
}

.xp-badge {
    font-size: 0.75rem;
    opacity: 0.8;
}

.add-task-btn {
    padding: 14px 24px;
    background: var(--blue);
    color: var(--white);
    border: 2px solid var(--black);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.add-task-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

/* Tasks Container */
.tasks-container {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.task-card.easy {
    border-left-color: var(--blue);
}

.task-card.medium {
    border-left-color: var(--blue);
}

.task-card.hard {
    border-left-color: var(--blue);
}

.task-card.completed {
    opacity: 0.6;
}

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

.task-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
}

.complete-btn {
    background: var(--blue);
    color: var(--white);
    border: 2px solid var(--black);
}

.complete-btn:hover {
    background: var(--blue);
    transform: scale(1.05);
}

.edit-btn {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.edit-btn:hover {
    background: var(--border-color);
}

.delete-btn {
    background: var(--grey);
    color: var(--white);
    border: 2px solid var(--black);
}

.delete-btn:hover {
    background: var(--grey);
    transform: scale(1.05);
}

.task-description-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.task-difficulty {
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.task-difficulty.easy {
    background: var(--blue);
    color: var(--white);
}

.task-difficulty.medium {
    background: var(--blue);
    color: var(--white);
}

.task-difficulty.hard {
    background: var(--blue);
    color: var(--white);
}

/* Daily Quests */
.quests-container {
    margin-bottom: 30px;
}

.quests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quest-card {
    background: var(--bg-secondary);
    padding: 18px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.quest-card.completed {
    border-color: var(--blue);
    background: var(--bg-secondary);
}

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

.quest-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.quest-icon {
    font-size: 1.3rem;
}

.quest-reward {
    font-size: 0.85rem;
    color: var(--blue);
    font-weight: 600;
    background: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--blue);
}

.quest-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.quest-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.quest-progress-fill {
    height: 100%;
    background: var(--blue);
    transition: width 0.4s ease;
    border-radius: 10px;
}

.quest-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.quest-card.completed .quest-progress-fill {
    background: var(--blue);
}

.quest-checkmark {
    color: var(--blue);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Badges */
.badges-container {
    margin-bottom: 30px;
}

.badges-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.badge-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.badge-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.badge-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.badge-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.badge-description-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    position: relative;
    border: 2px solid var(--black);
    box-shadow: var(--shadow-hover);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.badge-modal-content {
    text-align: center;
}

.badge-icon-large {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.badge-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.badge-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--blue);
    animation: confettiFall 3s ease-out forwards;
}

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

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--text-primary);
}

.footer-separator {
    margin: 0 10px;
}

/* Legal Pages */
.legal-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.legal-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.legal-content section {
    margin-bottom: 30px;
}

.legal-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.legal-content p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.legal-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }

    .app-title {
        font-size: 2rem;
    }

    .stats-bar {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .difficulty-options {
        flex-direction: column;
    }

    .task-header {
        flex-direction: column;
        gap: 10px;
    }

    .task-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .badges-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .legal-content {
        padding: 25px;
    }

    .legal-content h2 {
        font-size: 1.5rem;
    }

    .legal-content h3 {
        font-size: 1.1rem;
    }
}

/* Edit Mode */
.task-card.editing .task-title,
.task-card.editing .task-description-text {
    display: none;
}

.task-edit-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--black);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    margin-bottom: 8px;
}

.task-edit-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--black);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    font-family: inherit;
    margin-bottom: 8px;
}


