:root {
    /* Color Variables - Dark Mode */
    --primary-color: #9d8cff;       /* Lighter Purple for dark mode */
    --primary-light: #483d8b;       /* Darker purple for dark mode */
    --secondary-color: #ff9f30;     /* Brighter Orange for dark mode */
    --secondary-light: #4d3000;     /* Dark orange */
    --secondary-lighter: #3a2400;   /* Very dark orange */
    --success-color: #66bb6a;       /* Brighter Green for dark mode */
    --danger-color: #f44336;        /* Red */
    --danger-dark: #d32f2f;         /* Dark red */
    --warning-color: #ff7b7b;       /* Brighter Pink/Red for dark mode */
    --star-color: #ffb74d;          /* Brighter Star gold for dark mode */
    --text-color: #e0e0e0;          /* Light text for dark mode */
    --text-secondary: #b0b0b0;      /* Secondary text for dark mode */
    --background-color: #121212;    /* Dark background */
    --card-background: #1e1e1e;     /* Dark card background */
    --disabled-color: #555;         /* Darker disabled state */
    --chore-color: #66bb6a;         /* Green for chores */
    --reward-color: #ff9f30;        /* Orange for rewards */
    --card-background-light: #2d2d2d; /* Lighter card background */
    
    /* Spacing Variables */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 10px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    
    /* Border Radius */
    --border-radius-sm: 8px;
    --border-radius-md: 15px;
    --border-radius-lg: 50px;
    
    /* Shadow */
    --shadow-default: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    /* Transitions */
    --transition-default: all .2s ease;
    
    /* Mobile-specific styles */
    @media (max-width: 480px) {
        :root {
            --spacing-xs: 4px;
            --spacing-sm: 6px;
            --spacing-md: 10px;
            --spacing-lg: 15px;
            --spacing-xl: 20px;
            --font-sm: .8rem;
            --font-md: .9rem;
            --font-lg: 1.1rem;
            --font-xl: 1.3rem;
            --font-xxl: 1.6rem;
        }
        
        /* Very small screens adjustments */
        .reward-card {
            height: 220px;
            padding: 10px;
        }
        
        .redeem-btn {
            height: 36px;
            margin-top: 10px;
        }
        
        .container {
            padding: var(--spacing-sm);
        }
        
        .star-counter {
            width: 80px;
            height: 80px;
        }
        
        .star-counter .count-value {
            font-size: 1.8rem;
        }
        
        .chore-card {
            height: 120px;
        }
        
        .reward-card {
            height: 150px;
        }
        
        .chore-image {
            width: 70px;
            height: 65px;
        }
        
        .star-value img.star-icon {
            width: 20px;
            height: 20px;
        }
    }
    
    /* Font Sizes */
    --font-xs: 1rem;
    --font-sm: 1.1rem;
    --font-md: 1.2rem;
    --font-lg: 1.3rem;
    --font-xl: 2rem;
    --font-xxl: 2.2rem;
    --font-xxxl: 2.5rem;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--background-color) linear-gradient(to bottom, rgba(30,30,30,.05) 1px, transparent 1px);
    color: var(--text-color);
    background-size: 100% 20px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

button {
    cursor: pointer;
    border: 0;
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font: bold var(--font-xs) 'Nunito', sans-serif;
    transition: var(--transition-default);
}

button:hover {
    opacity: .9;
    transform: scale(1.05);
}

/* ===== HEADER STYLES ===== */
header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--card-background);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-default);
    margin-bottom: var(--spacing-xl);
    position: relative;
    overflow: visible;
}


header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: var(--font-xl); /* Reduced font size */
}

.star-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-left: auto;
    position: relative;
    z-index: 5;
}


h1 {
    color: var(--primary-color);
    font-size: var(--font-xxxl);
}

.logout-btn {
    background: #5c6bc0;
    color: white;
    border: 0;
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: .8rem;
    cursor: pointer;
    transition: var(--transition-default);
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-lg);
    z-index: 20;
    opacity: .8;
}

.logout-btn:hover {
    background: #3f51b5;
    transform: scale(1.05);
    opacity: 1;
}


@keyframes pulse-glow {
    from {
        box-shadow: 0 0 10px rgba(255,215,0, .7);
    }
    to {
        box-shadow: 0 0 20px rgba(255,215,0, .9), 0 0 30px rgba(255,165,0, .5);
    }
}

.star-icon {
    margin-left: var(--spacing-sm);
    width: 30px;
    height: 30px;
    vertical-align: middle;
}

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

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

.star-value img.star-icon {
    width: 24px;
    height: 24px;
    margin: 0 2px;
}

/* ===== CHORES GRID STYLES ===== */
.chores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    width: 100%;
    justify-content: center;
}


.chore-card {
    background: var(--card-background);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-xs);
    box-shadow: var(--shadow-default);
    transition: var(--transition-default);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: 210px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}



.chore-card.completed {
    animation: pulse 1s;
    box-shadow: 0 0 15px var(--primary-color);
}

.chore-title {
    font-size: var(--font-sm);
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    text-align: center;
    flex-shrink: 0;
    line-height: 1.2;
}

.chore-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    height: 130px;
}

.chore-image {
    width: 130px;
    height: 125px;
    object-fit: contain;
    margin-bottom: -5px;
    transition: transform .3s ease;
}

.star-value {
    font-weight: bold;
    color: var(--star-color);
    margin-bottom: 0;
    font-size: var(--font-sm);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: var(--spacing-xs) 0;
    width: 100%;
}

/* ===== STAR CONTROLS STYLES ===== */
.star-controls {
    display: flex;
    gap: var(--spacing-sm);
}


.add-star, .remove-star {
    padding: var(--spacing-xs) var(--spacing-lg);
    font-size: var(--font-sm);
    border-radius: var(--border-radius-lg);
    min-width: 140px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 3px 0 rgba(0,0,0,0.2);
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}

.add-star {
    background: var(--success-color);
    color: white;
}

.add-star::before {
    content: '+';
    font-size: 1.5em;
    margin-right: 8px;
}

.remove-star {
    background: var(--warning-color);
    color: white;
}

.remove-star::before {
    content: '-';
    font-size: 1.5em;
    margin-right: 8px;
}

.add-star:hover, .remove-star:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0,0,0,0.2);
}

.add-star:active, .remove-star:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

#reset-btn {
    background: var(--warning-color);
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-xs);
    display: block;
    margin: 0 auto;
}

.title-area {
    display: flex;
    align-items: center;
    position: relative;
}

.star-counter {
    position: relative;
    width: 100px;
    height: 100px;
    margin-left: var(--spacing-md);
    animation: float 3s ease-in-out infinite;
    z-index: 10;
    filter: drop-shadow(0 0 15px rgba(255,215,0, .7));
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-counter .star-bg,
.star-badge {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.star-counter .count-value {
    position: relative;
    font-size: 2rem;
    font-weight: bold;
    color: blueviolet;
    text-shadow: none;
    z-index: 6;
}

.star-counter .star-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 0 5px rgba(255,255,255,.8));
    animation: star-spin 10s linear infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,165,0, .7); }
    70% { box-shadow: 0 0 0 15px rgba(255,165,0, 0); }
}

/* ===== REWARDS SECTION STYLES ===== */
.rewards-section {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 3px dashed var(--primary-light);
}

.rewards-section h2 {
    color: var(--primary-color);
    font-size: var(--font-xl);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    width: 100%;
    margin-bottom: var(--spacing-xl);
}


.reward-card {
    background: var(--secondary-light);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-default);
    transition: var(--transition-default);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    width: 210px;
    height: 220px;
    overflow: hidden;
}


.chore-card:hover,
.reward-card:hover {
    transform: translateY(-5px);
}

.reward-title {
    font-size: var(--font-md);
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    height: auto;
    min-height: 20px;
}

.reward-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    margin-bottom: var(--spacing-sm);
}

.reward-image {
    max-width: 65px;
    max-height: 90px;
    object-fit: contain;
    transition: transform .3s ease;
}


.cost-value {
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.cost-value .star-icon {
    width: 24px;
    height: 24px;
    margin-left: 2px;
}


.redeem-btn {
    background: var(--secondary-color);
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    width: 100%;
    margin-top: var(--spacing-sm);
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}


.redeem-btn:hover:not(:disabled) {
    background: #ff7b00;
    transform: scale(1.05);
}

.redeem-btn:disabled {
    background: var(--disabled-color);
    cursor: not-allowed;
    opacity: .7;
}

/* ===== ANIMATIONS ===== */
@keyframes redeemed-flash {
    0%, 100% { box-shadow: 0 0 0 2px var(--secondary-color); }
    50% { box-shadow: 0 0 0 10px rgba(255,140,0, .5); }
}

.reward-card.redeemed {
    animation: redeemed-flash 1s ease;
    background: var(--secondary-lighter);
}

/* ===== HISTORY PAGE STYLES ===== */
.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-default);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.nav-link:hover {
    background: var(--card-background);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--text-color);
    font-weight: bold;
}

.history-container {
    background: var(--card-background);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-default);
}

.filter-btn {
    background: var(--card-background-light);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

.filter-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.history-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    background: var(--card-background-light);
    gap: var(--spacing-md);
}

.history-item.chore, .history-item.nice {
    border-left: 4px solid var(--chore-color);
}

.history-item.reward {
    border-left: 4px solid var(--reward-color);
}

.history-item.naughty {
    border-left: 4px solid #ff3333; /* Red color for naughty entries */
}

.history-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-content {
    flex: 1;
}

.history-title {
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
}

.history-details {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: var(--font-xs);
}

.history-stars {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: bold;
}

.history-stars.added {
    color: var(--chore-color);
}

.history-stars.spent {
    color: var(--reward-color);
}

.history-stars.naughty {
    color: #ff3333; /* Red color for naughty entries */
}

.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
    text-align: center;
}

.history-empty-state .history-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: .5;
}

/* ===== RESPONSIVE DESIGN - CONSOLIDATED MEDIA QUERIES ===== */
@media (max-width: 768px) {
    /* Header */
    header {
        flex-direction: column;
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }
    
    header h1 {
        margin-bottom: var(--spacing-sm);
        font-size: 1.8rem;
    }
    
    .title-area {
        margin-bottom: var(--spacing-md);
    }
    
    .logout-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: .8rem;
    }
    
    /* Star Controls */
    .star-controls {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    
    .star-controls button {
        flex: 1;
        min-width: 0;
        padding: var(--spacing-sm);
        font-size: .9rem;
    }
    
    /* Chores Grid */
    .chores-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--spacing-md);
    }
    
    .chore-card {
        width: 100%;
        height: 180px;
        padding: var(--spacing-md) var(--spacing-md) var(--spacing-xs);
    }
    
    .chore-image {
        width: 100px;
        height: 95px;
    }
    
    /* Rewards Grid */
    .rewards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--spacing-md);
    }
    
    .reward-card {
        width: 100%;
        height: 200px;
    }
    
    .reward-title {
        font-size: 1rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .reward-image-container {
        height: 90px;
        margin-top: var(--spacing-xs);
        margin-bottom: var(--spacing-xs);
    }
    
    .reward-image {
        max-width: 80px;
        max-height: 80px;
    }
    
    .cost-value {
        font-size: var(--font-md);
        margin-bottom: var(--spacing-sm);
    }
    
    .cost-value .star-icon {
        width: 20px;
        height: 20px;
    }
    
    .redeem-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: .9rem;
        height: 40px;
    }
}
