/* Dashboard Layout */
.dashboard-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', sans-serif;
    margin: 0;
    padding: 0;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar-expand {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 48px;
    background: var(--surface-secondary, #1a1a2e);
    border: 1px solid var(--border-primary, #2a2a3e);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--text-tertiary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.sidebar-expand:hover {
    background: var(--overlay-hover);
    color: var(--text-primary);
}

.sidebar.collapsed~.sidebar-expand {
    display: flex;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-primary);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.sidebar-logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--overlay-hover);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 0;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-quaternary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--overlay-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--overlay-active);
    color: var(--text-primary);
    border-left: 3px solid var(--text-primary);
}

.nav-item svg {
    flex-shrink: 0;
}

/* Pillar nav dots */
.pillar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background-image: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.45), transparent 60%);
}

.nav-item-move .pillar-dot { background-color: #E85A5A; box-shadow: 0 0 8px #E85A5Aaa, 0 0 16px #E85A5A44; }
.nav-item-fuel .pillar-dot { background-color: #5ABF6A; box-shadow: 0 0 8px #5ABF6Aaa, 0 0 16px #5ABF6A44; }
.nav-item-rest .pillar-dot { background-color: #9B7EC8; box-shadow: 0 0 8px #9B7EC8aa, 0 0 16px #9B7EC844; }
.nav-item-rise .pillar-dot { background-color: #E8A54A; box-shadow: 0 0 8px #E8A54Aaa, 0 0 16px #E8A54A44; }

/* Pillar-specific nav colors */
.nav-item-move:hover {
    color: #E85A5A;
}

.nav-item-fuel:hover {
    color: #5ABF6A;
}

.nav-item-rest:hover {
    color: #9B7EC8;
}

.nav-item-rise:hover {
    color: #E8A54A;
}

.nav-item-move.active {
    border-left-color: #E85A5A;
}

.nav-item-fuel.active {
    border-left-color: #5ABF6A;
}

.nav-item-rest.active {
    border-left-color: #9B7EC8;
}

.nav-item-rise.active {
    border-left-color: #E8A54A;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed+.main-content {
    margin-left: 0;
}

/* Top Header */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 3rem;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-left h1,
.header-left h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.page-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.95rem;
    color: var(--text-tertiary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-action {
    background: var(--overlay-hover);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-action:hover {
    background: var(--overlay-active);
    color: var(--text-primary);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--overlay-hover);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu-button:hover {
    background: var(--overlay-active);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E85A5A 0%, #E8A54A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-dropdown .menu-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.user-menu-dropdown .menu-item:hover {
    background: var(--overlay-active);
    color: var(--text-primary);
}

/* Dashboard Content */
.dashboard-content {
    padding: 3rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-card-move {
    border-left: 3px solid #E85A5A;
}

.stat-card-fuel {
    border-left: 3px solid #5ABF6A;
}

.stat-card-rest {
    border-left: 3px solid #9B7EC8;
}

.stat-card-rise {
    border-left: 3px solid #E8A54A;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-move .stat-icon {
    background: rgba(255, 69, 58, 0.15);
    color: #E85A5A;
}

.stat-card-fuel .stat-icon {
    background: rgba(50, 215, 75, 0.15);
    color: #5ABF6A;
}

.stat-card-rest .stat-icon {
    background: rgba(191, 90, 242, 0.15);
    color: #9B7EC8;
}

.stat-card-rise .stat-icon {
    background: rgba(255, 159, 10, 0.15);
    color: #E8A54A;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.875rem;
    color: var(--text-quaternary);
}

.stat-change.positive {
    color: #5ABF6A;
}

/* Pillars Section */
.pillars-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
}

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

.pillar-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.pillar-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.pillar-card-move:hover {
    border-color: #E85A5A;
    box-shadow: 0 15px 40px rgba(255, 69, 58, 0.3);
}

.pillar-card-fuel:hover {
    border-color: #5ABF6A;
    box-shadow: 0 15px 40px rgba(50, 215, 75, 0.3);
}

.pillar-card-rest:hover {
    border-color: #9B7EC8;
    box-shadow: 0 15px 40px rgba(191, 90, 242, 0.3);
}

.pillar-card-rise:hover {
    border-color: #E8A54A;
    box-shadow: 0 15px 40px rgba(255, 159, 10, 0.3);
}

.pillar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.pillar-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pillar-card-move .pillar-icon {
    background: rgba(255, 69, 58, 0.15);
    color: #E85A5A;
}

.pillar-card-fuel .pillar-icon {
    background: rgba(50, 215, 75, 0.15);
    color: #5ABF6A;
}

.pillar-card-rest .pillar-icon {
    background: rgba(191, 90, 242, 0.15);
    color: #9B7EC8;
}

.pillar-card-rise .pillar-icon {
    background: rgba(255, 159, 10, 0.15);
    color: #E8A54A;
}

.pillar-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.pillar-progress {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.progress-value {
    position: absolute;
    font-size: 2rem;
    font-weight: 700;
}

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

.pillar-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pillar-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.pillar-stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* Recent Activity */
.recent-section {
    margin-bottom: 3rem;
}

.activity-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    overflow: hidden;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    transition: all 0.2s ease;
}

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

.activity-item:hover {
    background: var(--overlay-hover);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon-move {
    background: rgba(255, 69, 58, 0.15);
    color: #E85A5A;
}

.activity-icon-fuel {
    background: rgba(50, 215, 75, 0.15);
    color: #5ABF6A;
}

.activity-icon-rest {
    background: rgba(191, 90, 242, 0.15);
    color: #9B7EC8;
}

.activity-icon-rise {
    background: rgba(255, 159, 10, 0.15);
    color: #E8A54A;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.activity-meta {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.activity-time {
    font-size: 0.875rem;
    color: var(--text-quaternary);
}

/* ── Mobile Pillar Nav (top) ── */
.mobile-pillar-nav {
    display: none;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-secondary, #111);
    border-bottom: 1px solid var(--border-primary, #222);
    padding: 0;
}

.mpn-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-tertiary, #555);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mpn-tab:hover,
.mpn-tab:active {
    color: var(--text-secondary, #999);
}

.mpn-tab.active {
    border-bottom-width: 2px;
    border-bottom-style: solid;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-280px);
    }

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

    .sidebar-expand {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .top-header {
        padding: 1.5rem 2rem;
    }

    .header-left h2 {
        display: none;
    }

    .dashboard-content {
        padding: 2rem;
    }

    .mobile-pillar-nav {
        display: flex;
    }
}

@media (max-width: 768px) {

    .stats-grid,
    .pillars-grid {
        grid-template-columns: 1fr;
    }

    .top-header {
        padding: 1rem 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .dashboard-content {
        padding: 1.5rem;
    }

    .user-name {
        display: none;
    }
}

/* ── Premium Gate Overlay ── */
.premium-gate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.premium-gate-card {
    text-align: center;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border-radius: 20px;
    background: var(--bg-card, #111);
    border: 1px solid var(--chart-card-border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.premium-gate-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
    background: rgba(232, 165, 74, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.premium-gate-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary, #fff);
}

.premium-gate-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary, rgba(255, 255, 255, 0.65));
    margin-bottom: 2rem;
}

.premium-gate-cta {
    display: inline-block;
    padding: 0.85rem 2.5rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #E8A54A, #e89a2e);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.premium-gate-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 165, 74, 0.35);
}

.premium-gate-sub {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
}

.premium-gate-sub a {
    color: var(--text-secondary, rgba(255, 255, 255, 0.65));
    text-decoration: underline;
}

/* ── Light Theme ── */
[data-theme="light"] .mobile-pillar-nav {
    background: var(--bg-surface, #f5f5f5);
    border-bottom-color: var(--border-primary, #ddd);
}

[data-theme="light"] .sidebar {
    background: var(--bg-surface);
    border-right-color: var(--border-primary);
}

[data-theme="light"] .top-header {
    background: var(--bg-tertiary);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-primary);
}

[data-theme="light"] .stat-card {
    box-shadow: var(--shadow-card);
    background: var(--bg-card);
}

[data-theme="light"] .stat-card:hover {
    box-shadow: var(--shadow-card-hover);
}

[data-theme="light"] .pillar-card {
    box-shadow: var(--shadow-card);
    background: var(--bg-card);
}

[data-theme="light"] .pillar-card:hover {
    box-shadow: var(--shadow-card-hover);
}

[data-theme="light"] .pillar-card-move:hover {
    border-color: #E85A5A;
    box-shadow: 0 15px 40px rgba(232, 90, 90, 0.15);
}

[data-theme="light"] .pillar-card-fuel:hover {
    border-color: #5ABF6A;
    box-shadow: 0 15px 40px rgba(90, 191, 106, 0.15);
}

[data-theme="light"] .pillar-card-rest:hover {
    border-color: #9B7EC8;
    box-shadow: 0 15px 40px rgba(155, 126, 200, 0.15);
}

[data-theme="light"] .pillar-card-rise:hover {
    border-color: #E8A54A;
    box-shadow: 0 15px 40px rgba(232, 165, 74, 0.15);
}

[data-theme="light"] .activity-list {
    box-shadow: var(--shadow-card);
    background: var(--bg-card);
}

[data-theme="light"] .user-menu-dropdown {
    box-shadow: var(--shadow-elevated);
    background: var(--bg-surface);
}

[data-theme="light"] .premium-gate {
    background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .premium-gate-card {
    background: #FFFFFF;
    box-shadow: var(--shadow-elevated);
}

[data-theme="light"] .sidebar-expand {
    background: var(--bg-surface);
    border-color: var(--border-primary);
}

/* ── Focus Visible ────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid #E85A5A;
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 8px 16px;
    z-index: 10001;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}