:root {
    --primary-color: #4facfe;
    --primary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --fire-gradient: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
    --secondary-color: #ff9a9e;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.75);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --success-color: #00b09b;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    --nav-height: 70px;
}

/* Themes */
body[data-theme="sunset"] {
    --primary-color: #f6d365;
    --primary-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --success-color: #f093fb;
}

body[data-theme="nature"] {
    --primary-color: #43e97b;
    --primary-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --success-color: #009efd;
}

body[data-theme="midnight"] {
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #a18cd1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    background-color: transparent;
    /* Changed from opaque to show bg-layer */
    padding-bottom: var(--nav-height);
}

/* SVG Icon Styles to replace FontAwesome */
.svg-icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: inline-block;
    vertical-align: -0.125em;
    transition: all 0.2s;
}

/* Background Animation Layer */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Fallback gradient if image fails */
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    transition: opacity 1.5s ease-in-out;
    opacity: 1;
    /* Ensure visible */
}

.bg-layer.active {
    opacity: 1;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(5px);
    z-index: -1;
}

/* Full Screen Overlay for Success */
.overlay-full {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.overlay-full.show {
    opacity: 1;
    pointer-events: all;
}

.celebration-content {
    text-align: center;
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-full.show .celebration-content {
    transform: scale(1);
}

.animate-pop {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #fce38a;
    text-shadow: 0 0 20px rgba(252, 227, 138, 0.5);
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.badge-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    opacity: 0.5;
    filter: grayscale(1);
    transition: all 0.3s;
}

.badge-card.unlocked {
    opacity: 1;
    filter: grayscale(0);
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.2);
    transform: translateY(-5px);
}

.badge-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #ffd700;
}

.badge-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.badge-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Settings Components */
.settings-group {
    margin-bottom: 1.5rem;
}

.theme-switcher {
    display: flex;
    gap: 10px;
    margin-top: 0.5rem;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-btn:hover,
.theme-btn.active {
    transform: scale(1.1);
    border-color: white;
}

.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.wallpaper-thumb {
    aspect-ratio: 16/9;
    background-size: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.7;
    transition: all 0.2s;
}

.wallpaper-thumb:hover,
.wallpaper-thumb.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}

.settings-actions {
    display: grid;
    gap: 10px;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

/* Top Bar (Streak & Lang) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.streak-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.flame-icon {
    font-size: 1.2rem;
    background: var(--fire-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(255, 94, 98, 0.6));
    animation: flicker 1.5s infinite alternate;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-heading);
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.lang-btn:hover {
    background: white;
    color: #333;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 2.8rem;
    font-family: var(--font-heading);
    font-weight: 800;
    margin-bottom: 0.2rem;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    letter-spacing: -1px;
}

.logo i {
    color: #4facfe;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 1px;
}

/* View Sections */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.icon-box {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-box.active {
    color: #fce38a;
}

.icon-box.completed {
    color: var(--success-color);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Glass Panel & Forms */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-main);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.add-goal-section h2,
.goals-list-section h2,
.glass-panel h2 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    transition: all 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
}

.btn-primary,
.btn-secondary {
    width: 100%;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-gradient);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.98);
}

/* Goals Grid */
.goals-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.goal-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.goal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.goal-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.goal-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.action-btn.delete:hover {
    background: #ff6b6b;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.action-btn.complete:hover {
    background: var(--success-color);
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3);
}

/* Progress */
.progress-container {
    margin: 1.2rem 0;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 5px;
    transition: width 1s ease-in-out;
}

.goal-card.completed .progress-bar-fill {
    background: var(--success-color);
}

.deadline-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.text-danger {
    color: #ff6b6b;
    font-weight: 600;
}

.stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 3rem;
    font-weight: 900;
    color: rgba(46, 204, 113, 0.2);
    pointer-events: none;
    z-index: 10;
    border: 4px solid rgba(46, 204, 113, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    white-space: nowrap;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 1.4rem;
    padding: 5px;
    border-radius: 10px;
    transition: transform 0.2s;
}

.nav-item.active {
    color: #4facfe;
}

.nav-item.active i {
    transform: translateY(-3px);
    background: rgba(79, 172, 254, 0.15);
}

/* Settings View */
.settings-grid {
    display: grid;
    gap: 1rem;
}

.upload-label {
    cursor: pointer;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
}

.styled-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    margin: 1.5rem 0;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4facfe;
    cursor: pointer;
}

.manual-input-wrapper {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    border-radius: 12px;
}

/* Animations */
@keyframes flicker {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card:last-child {
        grid-column: span 2;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .goals-grid {
        grid-template-columns: 1fr;
    }
}

/* Filter Buttons & Toggle & Categories */
.filter-controls {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 12px;
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.category-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 5px;
    display: inline-block;
}

.cat-health {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.cat-career {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.cat-education {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.cat-finance {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.cat-general {
    background: rgba(149, 165, 166, 0.2);
    color: #95a5a6;
    border: 1px solid rgba(149, 165, 166, 0.3);
}

.cat-habit {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
    transition: background 0.3s;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.checkbox-wrapper input:checked+.toggle-switch {
    background: var(--primary-color);
}

.checkbox-wrapper input:checked+.toggle-switch::after {
    transform: translateX(24px);
}

.checkbox-wrapper label {
    pointer-events: none;
    font-weight: 500;
}

/* Styled Select Dropdown */
.styled-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.styled-select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.3);
}

.styled-select option {
    background: #1a1a2e;
    color: white;
}