:root {
    --bg-light: #f8faf9;
    --card-bg: #ffffff;
    --card-border: #e8eee9;
    --primary: #2d8a3c;
    --primary-light: #4caf50;
    --secondary: #81c784;
    --text-main: #1b3d21;
    --text-muted: #6b8c71;
    --danger: #ef4444;
    --success: #10b981;
    --success-bg: #f0fdf4;
    --xp-color: #f59e0b;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --container-width: 900px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    width: 95%;
    max-width: var(--container-width);
    margin: 2rem auto;
    padding: 1rem;
}

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 0.4rem;
}

.app-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

h1 span {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
}

/* Dashboard Summary */
.dashboard-stats {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card.highlight .stat-value {
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.progress-and-mood {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.progress-card,
.mood-checkin-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #eef2ef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mood Checkin */
.mood-checkin-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.mood-options {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mood-btn {
    flex: 1;
    font-size: 1.5rem;
    padding: 0.6rem;
    background: #f8faf9;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mood-btn:hover:not(:disabled) {
    background: var(--success-bg);
    border-color: var(--secondary);
    transform: scale(1.05);
}

.mood-btn.selected {
    background: var(--success-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--secondary);
}

.mood-btn:disabled {
    cursor: default;
    opacity: 0.6;
}

.mood-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

.habit-form .input-group {
    display: grid;
    grid-template-columns: 1fr 140px auto;
    gap: 0.8rem;
    background: var(--card-bg);
    padding: 0.6rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
}

input[type="text"],
.difficulty-select {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
}

.difficulty-select {
    border-left: 1px solid var(--card-border);
    color: var(--text-muted);
    cursor: pointer;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--primary-light);
}

/* App Controls */
.app-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

select#filter-select,
select#sort-select {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-main);
    font-family: inherit;
}

/* Habit List & Cards */
.habits-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.habit-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    animation: slideUp 0.4s ease forwards;
}

.habit-card.completed {
    background: var(--success-bg);
    border-color: var(--secondary);
}

.habit-card.paused {
    opacity: 0.6;
    grayscale: 50%;
}

.habit-main-info {
    flex: 1;
}

.habit-header-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.habit-info {
    font-size: 1.1rem;
    font-weight: 600;
}

.difficulty-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.diff-easy {
    background: #dcfce7;
    color: #166534;
}

.diff-medium {
    background: #fef9c3;
    color: #854d0e;
}

.diff-hard {
    background: #fee2e2;
    color: #991b1b;
}

.habit-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.streak-progress-box {
    width: 120px;
}

.streak-bar-bg {
    height: 4px;
    background: #edf2ef;
    border-radius: 2px;
    margin-top: 4px;
}

.streak-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.habit-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.done-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--card-border);
    color: var(--card-border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.done-btn.completed {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.streak-bounce {
    animation: bounce 0.4s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

.xp-bubble {
    position: absolute;
    color: var(--xp-color);
    font-weight: 800;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-40px);
        opacity: 0;
    }
}

/* Footer Actions */
.actions-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.text-btn {
    background: transparent;
    border: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.text-btn:hover {
    color: var(--danger);
}

.app-footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .progress-and-mood {
        grid-template-columns: 1fr;
    }

    .habit-form .input-group {
        grid-template-columns: 1fr;
    }

    .difficulty-select {
        border-left: none;
        border-top: 1px solid var(--card-border);
    }
}