/* ==========================================================================
   G-SIP - Global-Systematic Investment Plan
   Authenticated Application Shell & Dashboard Layout
   ========================================================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-dark);
}

/* Sidebar Navigation */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.03em;
}

.brand-badge {
    background: var(--primary-gradient);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    color: var(--text-secondary);
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active a {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: var(--shadow-sm);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header Bar */
.app-header {
    height: var(--header-height);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: var(--glass-backdrop);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.demo-banner {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.header-action-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-dark);
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

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

/* App Body & Main View */
.app-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

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

.page-title-group h1 {
    font-size: 1.75rem;
    font-weight: 800;
}

.page-title-group p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Dashboard Summary Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.metric-card.emerald::before { background: var(--accent-emerald-gradient); }
.metric-card.gold::before { background: var(--accent-gold-gradient); }

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

.metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.metric-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.metric-change-up { color: var(--success); font-weight: 700; }

/* Chart Container */
.chart-card {
    margin-bottom: 2rem;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
    margin-top: 1rem;
}

/* Sticky Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(6, 9, 17, 0.95);
    backdrop-filter: var(--glass-backdrop);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.mobile-nav-item svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   Recent Activity Filters & Enhanced Item Badges
   ========================================================================== */
.activity-filter-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

.activity-filter-scroll::-webkit-scrollbar {
    display: none;
}

.activity-filter-btn {
    padding: 0.28rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.activity-filter-btn:hover {
    color: var(--text-primary, #ffffff);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.activity-filter-btn.active {
    color: #ffffff !important;
    background: var(--primary, #6366f1) !important;
    border-color: var(--primary, #6366f1) !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .activity-filter-btn {
    color: #475569 !important;
    background: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .activity-filter-btn:hover {
    color: #0f172a !important;
    background: #e2e8f0 !important;
}

[data-theme="light"] .activity-filter-btn.active {
    color: #ffffff !important;
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

.activity-item-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.activity-chip {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 0.04em;
    display: inline-block;
    vertical-align: middle;
}

.chip-yield { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.chip-refer { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.chip-task { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.chip-spin { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.chip-deposit { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.chip-withdrawal { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.chip-plan { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* Full Ledger Page Styles */
.ledger-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.4) rgba(255, 255, 255, 0.03);
    -webkit-overflow-scrolling: touch;
}

.ledger-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.ledger-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 9999px;
}

.ledger-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.35);
    border-radius: 9999px;
}

.ledger-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

.ledger-item-row {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 0.75rem 0.6rem !important;
}

.ledger-item-row:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(2px);
}

[data-theme="light"] .ledger-item-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .ledger-scroll-container {
    scrollbar-color: rgba(99, 102, 241, 0.3) rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .ledger-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

[data-theme="light"] .ledger-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

