* {
    box-sizing: border-box;
}

:root {
    --bg-color: var(--mc-bg, #f8fafc);
    --card-bg: var(--mc-surface, #ffffff);
    --text-primary: var(--mc-text-primary, #0f172a);
    --text-secondary: var(--mc-text-secondary, #475569);
    --accent-lavender: var(--mc-primary, #0F766E);
    --accent-sky: var(--mc-primary-dark, #0f766e);
    --accent-teal: var(--mc-primary, #0F766E);
    --border-color: var(--mc-border, #e2e8f0);
    --radius-lg: var(--mc-radius-lg, 14px);
    --radius-md: var(--mc-radius-md, 10px);
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 20px;
    --spacing-lg: 32px;
    --shadow-sm: var(--mc-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    --shadow-md: var(--mc-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.06));
}

/* Charcoal Theme - Solid & Premium */
body.theme-charcoal {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body.theme-charcoal .mobile-top-bar, 
body.theme-charcoal .bottom-nav,
body.theme-charcoal #journalForm {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.theme-charcoal .dash-top-bar,
body.theme-charcoal .community-top-bar {
    background: #1e293b !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-color: #334155 !important;
}

body.theme-charcoal .dash-top-bar .top-action-btn,
body.theme-charcoal .community-top-bar .back-btn,
body.theme-charcoal .community-top-bar .top-action-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}

body.theme-charcoal .checkin-card-premium,
body.theme-charcoal .post-card-v2,
body.theme-charcoal .challenge-card,
body.theme-charcoal .circle-card,
body.theme-charcoal .thought-of-day,
body.theme-charcoal .trend-pill {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.theme-charcoal #postForm .post-form-header {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.theme-charcoal #postForm {
    background: #0f172a !important;
}

body.theme-charcoal .post-form-close {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}

body.theme-charcoal .ig-card {
    background: #1e293b;
    border-color: #334155;
}

body.theme-charcoal h1, 
body.theme-charcoal h2, 
body.theme-charcoal h3,
body.theme-charcoal .back-btn-top {
    color: #f8fafc !important;
}

body.theme-charcoal .nav-item {
    color: #94a3b8 !important;
}

body.theme-charcoal .nav-item.active {
    color: var(--mc-primary) !important;
}

body.theme-charcoal .smiley-center-btn {
    border-color: #1e293b !important;
    background: var(--mc-primary, #0F766E) !important;
}

body.theme-charcoal .smiley-action-label {
    background: #1e293b !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--mc-font-sans, 'Outfit', system-ui, sans-serif);
    margin: 0;
    padding: 0;
    line-height: 1.55;
    /* Auth Guard */
}


.main-content {
    padding-top: 0;
    padding-bottom: 80px;
    max-width: 600px;
    margin: 0 auto !important;
    width: 100% !important;
    overflow-x: hidden;
}

@media (min-width: 1024px) {
    .main-content {
        max-width: 1100px;
    }
}

/* Card Styles */
.ig-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

/* Grid Utilities */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

@media (min-width: 1024px) {
    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
    
    .full-width-on-desktop {
        grid-column: 1 / -1;
    }
}

.ig-card-image {
    width: 200px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

/* Typography */
.section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: var(--spacing-md) 0 var(--spacing-sm) var(--spacing-xs);
}

h1, h2, h3 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
}

/* Buttons */
.btn-primary {
    background: var(--accent-lavender);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--mc-radius-sm, 6px);
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: var(--accent-sky);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-lavender);
    color: var(--accent-lavender);
    padding: 8px 18px;
    border-radius: var(--mc-radius-sm, 6px);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-outline:hover {
    background: var(--mc-primary-light, #f0fdfa);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-lavender);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: var(--shadow-md);
    border: none;
    cursor: pointer;
    z-index: 1000;
}

/* Navigation Overrides and Base Styles */
.bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px;
    background: #ffffff !important;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    z-index: 9999 !important;
    border-top: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 4px;
    flex: 1;
    text-align: center;
}

.nav-item.active {
    color: var(--accent-lavender);
}

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

/* Utility */
.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: var(--spacing-md) 0;
}

.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-secondary); }

/* Back Button */
.back-btn-top {
    font-size: 1.1rem;
    color: var(--text-primary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.back-btn-top:hover {
    background: var(--border-color);
}

.mobile-top-bar {
    display: grid !important;
    grid-template-columns: 48px 1fr 48px !important;
    position: sticky !important;
    top: 0 !important;
    background: #ffffff !important;
    height: 56px !important;
    border-bottom: 1px solid var(--border-color) !important;
    align-items: center !important;
    z-index: 1000 !important;
    padding: 0 12px !important;
}

.mobile-top-bar .mobile-logo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    position: relative !important;
    left: auto !important;
    transform: none !important;
}

.mobile-top-bar .mobile-logo span {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--text-primary) !important;
}

@media (max-width: 380px) {
    .mobile-top-bar {
        grid-template-columns: 40px 1fr 40px !important;
        height: 52px !important;
    }
    .mobile-top-bar .mobile-logo span {
        font-size: 0.95rem !important;
    }
}
