:root {
    --primary-color: #d4a373;
    /* Elegant beige/gold */
    --primary-dark: #b08968;
    --secondary-color: #faedcd;
    /* Light cream */
    --accent-color: #ccd5ae;
    /* Soft green */
    --text-dark: #333333;
    --text-light: #777777;
    --white: #ffffff;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius-lg: 24px;
    --radius-md: 16px;
    --font-main: 'Outfit', sans-serif;
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: #f0f2f5;
    color: var(--text-dark);
    line-height: 1.5;
    height: 100vh;
    height: 100dvh;
    /* Mobile viewport fix */
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 480px;
    background-color: #fdfaf5;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ... existing styles ... */

/* Bottom Nav */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 24px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.05);
    z-index: 300;
    /* Ensure it's above Detail View (200) */
}

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

.main-header h1 {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    color: var(--primary-color);
    text-transform: uppercase;
    margin: 0;
}

.streak-widget-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff0eb;
    padding: 4px 10px;
    border-radius: 20px;
    color: #e56b4d;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 90px 0;
    /* Space for bottom nav */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- HOME DASHBOARD --- */
.home-container {
    padding: 24px 20px;
    animation: fadeIn 0.4s ease-out;
}

.welcome-section {
    margin-bottom: 24px;
}

.welcome-title {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.welcome-subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
}

.section-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: block;
}

/* Updated Quick Actions for Images */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    /* Stacked on mobile ? Or keep 2 cols? Let's do 1 big + 2 small or just vertical list */
    gap: 16px;
}

.action-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.02);
    position: relative;
    height: 120px;
    /* Taller for image background */
    display: flex;
    align-items: flex-end;
    /* Text at bottom */
}

.action-card:active {
    transform: scale(0.98);
}

.action-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: transform 0.5s;
}

.action-card:hover .action-card-bg {
    transform: scale(1.05);
}

.action-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    z-index: 2;
}

.action-card-text {
    position: relative;
    z-index: 3;
    padding: 16px;
    color: white;
    width: 100%;
}

.action-card-text h4 {
    font-size: 1.2rem;
    margin-bottom: 2px;
    font-weight: 600;
}

.action-card-text p {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Hero Section in Tabs */
.tab-hero {
    padding: 30px 20px 40px;
    background: linear-gradient(135deg, var(--secondary-color), #fff);
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    margin-bottom: 24px;
    text-align: center;
}

.tab-hero h2 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.tab-hero p {
    color: var(--text-light);
    font-size: 0.9rem;
    max-width: 80%;
    margin: 0 auto;
}

/* Module Switcher */
.module-switcher {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.module-btn {
    padding: 8px 18px;
    border-radius: 30px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.module-btn.active {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(212, 163, 115, 0.3);
}

/* Cards List */
.cards-container {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.4s ease-out;
}

.card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s;
    cursor: pointer;
}

.card:active {
    transform: scale(0.98);
}

.card-image {
    width: 100%;
    height: 180px;
    background-color: #eee;
    object-fit: cover;
}

.card-content {
    padding: 16px;
}

.card-title {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Detail View (Modal) */
.detail-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.detail-view.active {
    transform: translateX(0);
}

.detail-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 10;
    color: white;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.detail-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    flex-shrink: 0;
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--white);
    margin-top: -20px;
    /* Overlap image */
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    position: relative;
    z-index: 5;
}

.detail-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.detail-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 24px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title {
    font-size: 1.1rem;
    margin: 24px 0 12px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title svg {
    color: var(--primary-color);
}

.detail-list {
    list-style: none;
    padding: 0;
}

.detail-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

.detail-list li::before {
    content: "•";
    color: var(--primary-color);
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

.step-list {
    counter-reset: step;
    list-style: none;
}

.step-item {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.step-num {
    background: var(--secondary-color);
    color: var(--primary-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-text {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    padding-top: 2px;
}

/* Routine Tab Styles */
.routine-container {
    padding: 24px 20px;
    animation: fadeIn 0.4s ease-out;
}

.routine-header {
    margin-bottom: 24px;
}

.routine-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.routine-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.routine-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.routine-item {
    background: white;
    padding: 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.routine-item.completed {
    border-color: #a7c957;
    background: #f7fbf0;
}

.checkbox-circle {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
}

.routine-item.completed .checkbox-circle {
    background: #a7c957;
    border-color: #a7c957;
    color: white;
}

.routine-text {
    flex: 1;
}

.routine-title {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.routine-time {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Bottom Nav */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 24px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.05);
    z-index: 300;
    /* Always on top */
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
    flex: 1;
}

.nav-btn.active {
    color: var(--primary-color);
}

.nav-btn span {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Profile Styles */
.profile-container {
    padding: 24px 20px;
    padding-bottom: 100px;
}

.profile-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.profile-header p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.profile-section {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.profile-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    gap: 12px;
}

.profile-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.profile-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.profile-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-btn:active {
    transform: scale(0.96);
}

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

.danger-btn {
    background: #fee2e2;
    color: #ef4444;
    width: 100%;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.setting-item:last-child {
    border-bottom: none;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.danger-zone {
    background: transparent;
    box-shadow: none;
    text-align: center;
}

.tiny-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
}

.app-version {
    text-align: center;
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 40px;
}