:root {
    --primary-color: #FF85A1;
    --primary-light: #FFB7C5;
    --secondary-color: #9D85D1;
    --accent-color: #FFD1DC;
    --bg-color: #FCF8F8;
    --card-bg: rgba(255, 255, 255, 0.84);
    --text-main: #4A4A4A;
    --text-muted: #8E8E8E;
    --sidebar-bg: #FFFFFF;
    --shadow-soft: 0 10px 40px rgba(255, 133, 161, 0.12);
    --glass-border: rgba(255, 255, 255, 0.5);
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

body.dark-theme {
    --bg-color: #0F111A;
    --sidebar-bg: #161925;
    --card-bg: rgba(30, 34, 51, 0.8);
    --text-main: #E0E0E0;
    --text-muted: #A0A0A0;
    --accent-color: rgba(255, 133, 161, 0.15);
    --glass-border: rgba(255, 255, 255, 0.05);
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, .logo span {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 3rem;
}

.nav-menu {
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 15px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background: var(--accent-color);
    color: var(--primary-color);
}

.nav-item i {
    font-size: 1.2rem;
}

.sidebar-footer {
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.greeting h1 {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.greeting p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

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

.add-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 133, 161, 0.3);
    transition: var(--transition);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 133, 161, 0.4);
}

.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.05);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: 25px;
    padding: 1.8rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.summary-card {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 209, 220, 0.4));
    padding: 2.5rem;
}

.summary-content h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.progress-bar-container {
    width: 300px;
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 1s ease-in-out;
}

.circular-progress {
    width: 120px;
    position: relative;
}

/* LevelUp Features: Insights & Charts */
.insights-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.chart-container {
    height: 120px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-top: 10px;
}

.chart-bar {
    flex: 1;
    background: var(--accent-color);
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: var(--transition);
}

.chart-bar:hover { background: var(--primary-color); }

.chart-bar::after {
    content: attr(data-day);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-muted);
}

.balance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.balance-item {
    padding: 1rem;
    background: rgba(0,0,0,0.02);
    border-radius: 15px;
    text-align: center;
}

.balance-item span { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.balance-item strong { font-size: 1.2rem; color: var(--primary-color); }

.circular-chart {
    display: block;
    margin: 10px auto;
    max-width: 100%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: rgba(0,0,0,0.05);
    stroke-width: 2.8;
}

.circle {
    fill: none;
    stroke-width: 2.8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.circular-chart.pink .circle {
    stroke: var(--primary-color);
}

.percentage {
    fill: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.5rem;
    text-anchor: middle;
    font-weight: 700;
}

/* Habits List */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.category-filters {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

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

.consistency-grid {
    display: grid;
    grid-template-columns: repeat(53, 1fr);
    gap: 4px;
    margin-top: 1rem;
}

.grid-cell {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.03);
    border-radius: 2px;
}

.grid-cell.active {
    background: var(--primary-color);
}

.grid-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-cell {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.grid-cell.level-1 { background: var(--accent-color); }
.grid-cell.level-2 { background: var(--primary-light); }
.grid-cell.level-3 { background: var(--primary-color); }

/* Journal Section */
.journal-section {
    margin-bottom: 2.5rem;
}

.journal-card textarea {
    width: 100%;
    min-height: 150px;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 1.1rem;
    color: var(--text-main);
    resize: none;
    line-height: 1.6;
    padding: 0.5rem 0;
}

.save-journal-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.save-journal-btn:hover {
    transform: translateY(-2px);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title h2 {
    font-size: 1.8rem;
}

.badge {
    background: var(--accent-color);
    color: var(--primary-color);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.habit-card {
    background: white;
    border-radius: 22px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.02);
}

.habit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.habit-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: var(--accent-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.habit-info h4 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.habit-streak {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.habit-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.check-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: transparent;
}

.check-btn.completed {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.check-btn i {
    font-size: 1rem;
}

/* Wellness Panel */
.wellness-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.affirmation-card {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.affirmation-card i {
    font-size: 2rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.affirmation-card p {
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

.mood-card h3 {
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
}

.mood-options {
    display: flex;
    justify-content: space-between;
}

.mood-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    filter: grayscale(1);
    opacity: 0.5;
}

.mood-btn:hover, .mood-btn.active {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.2);
}

.streak-card {
    text-align: center;
}

.streak-value {
    margin: 1.5rem 0;
}

.streak-value span {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.streak-value small {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-family: 'Playfair Display', serif;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 2.5rem;
    position: relative;
    animation: slideUp 0.4s ease-out;
}

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

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

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid rgba(0,0,0,0.1);
    outline: none;
    font-size: 1rem;
}

.icon-selector {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.icon-selector label {
    cursor: pointer;
    text-align: center;
}

.icon-selector input {
    display: none;
}

.icon-selector i {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 12px;
    transition: var(--transition);
}

.icon-selector input:checked + i {
    background: var(--primary-color);
    color: white;
}

.submit-btn {
    width: 100%;
    padding: 1.2rem;
    border-radius: 15px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        width: 80px;
        padding: 1.5rem 0.5rem;
    }
    .logo span, .nav-item span, .user-info {
        display: none;
    }
    .nav-item {
        justify-content: center;
    }
}

/* High-End Mobile UI Refresh */
@media (max-width: 768px) {
    .sidebar { display: none !important; }
    
    .main-content {
        padding: 1.2rem 1.2rem 6rem 1.2rem;
        background: #FCF8F8;
    }

    .top-bar {
        margin-bottom: 2rem;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .greeting h1 {
        font-size: 1.5rem;
        margin-bottom: 2px;
    }

    .greeting p { font-size: 0.9rem; }

    .actions .add-btn span { display: none; }
    .actions .add-btn { padding: 12px; border-radius: 50%; width: 45px; height: 45px; justify-content: center; }

    .dashboard-grid { gap: 1.2rem; }

    .card { padding: 1.2rem; border-radius: 20px; }

    .summary-card {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1.2rem;
    }

    .circular-progress { width: 100px; order: -1; margin-bottom: 1rem; }

    .consistency-grid {
        gap: 3px;
        padding-bottom: 5px;
    }

    .grid-cell { min-width: 10px; height: 10px; }

    .section-header-row {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .category-filters {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
        white-space: nowrap;
        gap: 8px;
    }

    .filter-btn { padding: 0.4rem 1rem; font-size: 0.8rem; flex-shrink: 0; }

    .bottom-nav {
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid rgba(0,0,0,0.03);
        height: 70px;
        padding: 0;
    }

    .bottom-nav .nav-item {
        color: #BDBDBD;
        flex: 1;
        transition: 0.3s;
    }

    .bottom-nav .nav-item.active {
        color: var(--primary-color);
        background: transparent;
    }

    .bottom-nav .nav-item i { font-size: 1.4rem; }
    .bottom-nav .nav-item span { font-size: 0.6rem; margin-top: 2px; }

    .habit-card { padding: 1.2rem; border-radius: 18px; }
    .habit-icon-wrapper { width: 45px; height: 45px; border-radius: 12px; }
}

.bottom-nav {
    display: none;
}
