:root {
    /* LifePlan Premium Light Palette */
    --primary: #102A43;
    /* Deep Blue / Petrol - Primary Brand */
    --primary-light: #243B53;
    --primary-gradient: linear-gradient(135deg, #102A43, #243B53);

    --secondary: #38B2AC;
    /* Soft Green - Action/Success */
    --secondary-gradient: linear-gradient(135deg, #38B2AC, #319795);

    --accent-gold: #ECC94B;
    /* Discreet Yellow - Info/Highlights */
    --accent-red: #E53E3E;
    /* Soft Red - Errors/Expenses */
    --accent-green: #38B2AC;
    /* Matches secondary */

    /* Backgrounds */
    --bg-page: #F0F4F8;
    /* Light Off-white */
    --bg-sidebar: #102A43;
    /* Deep Blue */
    --bg-card: #FFFFFF;
    --bg-input: #E2E8F0;

    /* Text */
    --text-main: #102A43;
    /* Dark Blue/Gray */
    --text-light: #FFFFFF;
    /* For sidebar/buttons */
    --text-muted: #486581;
    /* Blueish Gray */
    --text-placeholder: #829AB1;

    /* Borders & Shadows */
    --glass-border: #D9E2EC;
    /* Keeping var name for JS compatibility but mapped to solid color */
    --shadow-card: 0 4px 6px rgba(16, 42, 67, 0.05), 0 1px 3px rgba(16, 42, 67, 0.1);
    --shadow-hover: 0 10px 15px rgba(16, 42, 67, 0.1);

    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

html,
body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

#app {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

body {
    background: var(--bg-page);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.login-wrap {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Ensure it doesn't cause overflow on mobile */
    margin: 20px auto;
    height: auto;
    max-height: 90vh;
    /* Prevent it from going off screen */
    overflow-y: auto;
    /* Scroll if content is too tall */
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

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

.text-right {
    text-align: right;
}

.uppercase {
    text-transform: uppercase;
}

/* Colors */
.text-purple {
    color: var(--primary);
}

.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.text-muted {
    color: var(--text-muted);
}

/* Card Styles */
.glass-card {
    /* Keeping class name for compatibility */
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    color: var(--text-main);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 100%;
}

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

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

h3 {
    font-size: 1.2rem;
}

p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn.primary {
    background: var(--primary);
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(16, 42, 67, 0.2);
}

.btn.primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(16, 42, 67, 0.25);
}

.btn.secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
    background: #CBD5E0;
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn.icon-btn {
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
}

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

/* Inputs */
input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    margin-bottom: 15px;
    transition: 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-placeholder);
}

/* Layout */
#app {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: none;
    display: none !important;
    /* Force hidden */
    flex-direction: column;
    padding: 30px 20px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

body.logged-in .sidebar {
    display: flex !important;
    /* Show only when logged in */
}

.sidebar-header {
    margin-bottom: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.sidebar-header img {
    filter: brightness(0) invert(1);
}

/* Make logo white */

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 5px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    transition: 0.2s;
    font-weight: 500;
}

.nav-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 3px solid var(--secondary);
}

.nav-btn i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 40px;
    overflow-y: auto;
    min-height: 100vh;
}

.view {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 80px 20px 40px;
    }

    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-sidebar);
        color: white;
        align-items: center;
        padding: 0 20px;
        z-index: 99;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu-btn {
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }
}

/* Internal Layouts */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Login */
.login-wrap {
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
    /* Stack children (box and credits) vertically */
    align-items: center;
    justify-content: center;
    height: 100vh;
    position: relative;
    z-index: 2000;
    /* Ensure on top of sidebar */
}

.login-overlay {
    display: none;
}

.login-box {
    max-width: 400px;
    width: 90%;
    /* .glass-card styles apply */
    padding: 40px;
    border: 1px solid var(--glass-border);
    background: white;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-sidebar);
    color: white;
    border-left: 4px solid var(--secondary);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateY(100px);
    transition: 0.3s;
    opacity: 0;
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

/* Tabs */
.btn-tab {
    color: var(--text-muted);
    background: transparent;
}

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

.btn-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 42, 67, 0.2);
}

#habits-tabs {
    background: var(--bg-input);
    padding: 5px !important;
    gap: 5px;
    border-radius: 12px;
}

/* Carousel */
.carousel-container {
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

.carousel-slide {
    display: none;
    animation: fadeEffect 0.5s;
}

.carousel-slide.active {
    display: block;
    animation: fadeEffect 0.5s;
}

@keyframes fadeEffect {
    from {
        opacity: 0.4;
    }

    to {
        opacity: 1;
    }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(16, 42, 67, 0.1);
    border: none;
    color: var(--primary);
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 5;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.carousel-btn:hover {
    background: var(--primary);
    color: white;
}

.carousel-btn.prev {
    left: -10px;
}

.carousel-btn.next {
    right: -10px;
}

@media (min-width: 768px) {
    .carousel-btn.prev {
        left: 0;
    }

    .carousel-btn.next {
        right: 0;
    }
}

/* Modals */
.modal-overlay-bg {
    background: rgba(16, 42, 67, 0.8);
}

#chat-input {
    color: var(--text-main) !important;
}

/* Landing Page Specifics */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.flex-wrap {
    flex-wrap: wrap;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.p-20 {
    padding: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-40 {
    margin-bottom: 40px;
}

/* In case login-wrap was overridden or needs specific adjust in hero */
.landing-hero .login-wrap {
    background: rgba(255, 255, 255, 0.95);
    /* Slightly more opaque */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: translateY(0);
    animation: float 6s ease-in-out infinite;
    /* Reset height override to be content based if needed, or keep existing */
    height: auto;
    min-height: auto;
    margin-top: 0;
    /* Reset default margin */
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@media (max-width: 768px) {
    .landing-hero {
        text-align: center;
    }

    .landing-hero h1 {
        font-size: 2.5rem !important;
    }

    .landing-hero .flex {
        justify-content: center;
        flex-direction: column;
        /* Force stack */
    }

    .landing-hero .hero-content {
        margin-bottom: 40px;
        width: 100%;
    }

    .landing-hero .hero-form {
        width: 100%;
        padding: 0;
    }

    .landing-hero .login-wrap {
        width: 100%;
        max-width: 100%;
        /* Ensure it fits */
        margin: 0 auto;
        box-shadow: none;
        /* Cleaner on mobile */
        border: 1px solid var(--glass-border);
    }

    .grid-3 {
        grid-template-columns: 1fr;
        /* Stack grid items */
    }
}

/* Ensure sections don't overflow */
.landing-hero,
.landing-features,
.landing-pricing,
footer {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    h1 {
        font-size: 2rem !important;
        word-wrap: break-word;
    }

    .glass-card {
        padding: 15px;
    }

    .login-wrap {
        padding: 20px;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}