/* ────────────────────────────────────────
   dashboard.css — Dashboard Page
   dashboard.php + sidebar + top bar
   ──────────────────────────────────────── */

.dashboard-page {
    margin-left: 260px;
}
   /* ── Dashboard Content Wrapper ── */
.dashboard-content {
    position: relative;
    z-index: 1;
    overflow: visible;
    clear: both;
}

/* ── Dashboard Header ── */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--gold);
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-family: var(--serif);
    font-size: 2rem;
    color: var(--terracotta);
}

.dashboard-header .email {
    font-size: 0.95rem;
    color: var(--muted);
}

/* ── Page Container ── */
.page-container {
    min-height: 100vh;
    padding: 8rem 2rem 3rem;
    background: var(--cream);
    position: relative;
    overflow: hidden;
    margin-left: 260px; /* ← THIS IS CRITICAL */
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Body Padding for Fixed Top Bar ── */
body {
    padding-top: 64px;
}

/* ── Welcome Message ── */
.welcome-message {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.welcome-message strong {
    color: var(--terracotta);
}

/* ── Dashboard Cards ── */
.dashboard-card {
    background: rgba(250, 250, 250, 0.92);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 2rem 2rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 40px rgba(26, 26, 26, 0.12), 0 2px 16px rgba(26, 26, 26, 0.06);
    border-top: 4px solid var(--gold);
    overflow: visible;
    clear: both;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 60px rgba(26, 26, 26, 0.20), 0 6px 24px rgba(26, 26, 26, 0.08);
}

.dashboard-card h2 {
    font-family: var(--serif);
    font-size: 1.3rem;
    color: var(--charcoal);
    margin-bottom: 0.75rem;
}

.dashboard-card p {
    color: var(--muted);
    line-height: 1.7;
}

.dashboard-card .profile-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--terracotta);
    font-weight: 600;
    text-decoration: underline;
}

.dashboard-card .profile-link:hover {
    color: var(--terracotta-dark);
}

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

.stat-item {
    background: var(--off-white);
    padding: 1.5rem 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(193, 105, 60, 0.10);
    box-shadow: 0 4px 16px rgba(26, 26, 26, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(26, 26, 26, 0.12);
}

.stat-item .number {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 800;
    color: var(--terracotta);
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

/* ── Profile Status Badge ── */
.profile-status {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.profile-status.complete {
    background: #e0f5e8;
    color: #1a7a4a;
}

.profile-status.incomplete {
    background: #fde8e0;
    color: #c95a3a;
}

/* ── TOP BAR ── */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(218, 165, 32, 0.12);
}

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

.top-bar-left .logo {
    font-family: var(--serif);
    font-size: 1.2rem;
    color: var(--gold);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
}

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

.top-bar-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 1.2rem;
    position: relative;
    transition: color 0.2s;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
}

.top-bar-link.top-bar-text {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-right: 0.3rem;
}
@media (max-width: 600px) {
    .top-bar-link.top-bar-text { display: none; } /* sidebar has them on mobile */
}

.top-bar-link:hover {
    color: var(--gold);
}

.top-bar-link .badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #c95a3a;
    color: #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* ── SIDEBAR TOGGLE (Hamburger) ── */
.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
}

.sidebar-toggle span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--off-white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.sidebar-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ── SIDEBAR ── */
.sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 999;
    background: rgba(26, 26, 26, 0.98);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(218, 165, 32, 0.06);
    overflow-y: auto;
    padding: 0.75rem 0.75rem 1.5rem;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(218, 165, 32, 0.3);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(218, 165, 32, 0.5);
}

/* ── Sidebar Links ── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--sans);
}

.sidebar-link:hover {
    background: rgba(218, 165, 32, 0.08);
    color: var(--gold);
}

.sidebar-link.active {
    background: rgba(218, 165, 32, 0.12);
    color: var(--gold);
}

.sidebar-link .icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link .label {
    flex: 1;
}

.sidebar-link .badge {
    background: #c95a3a;
    color: #fff;
    border-radius: 50%;
    padding: 0.1rem 0.4rem;
    font-size: 0.6rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-link.logout {
    color: rgba(255, 255, 255, 0.45);
}

.sidebar-link.logout:hover {
    background: rgba(201, 90, 58, 0.12);
    color: #c95a3a;
}

.sidebar-link.sub {
    padding-left: 2.4rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-link.sub:hover {
    color: var(--gold);
}

.sidebar-link.sub.active {
    color: var(--gold);
}

/* ── Sidebar Groups (Expandable) ── */
.sidebar-group {
    margin: 0.1rem 0;
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--sans);
}

.sidebar-group-toggle:hover {
    background: rgba(218, 165, 32, 0.08);
    color: var(--gold);
}

.sidebar-group-toggle .icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-group-toggle .label {
    flex: 1;
}

.sidebar-group-toggle .arrow {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

.sidebar-group.open .sidebar-group-toggle .arrow {
    transform: rotate(180deg);
}

.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 0.5rem;
}

.sidebar-group.open .sidebar-group-items {
    max-height: 400px;
}

.sidebar-group-items .sidebar-link {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-group-items .sidebar-link:hover {
    color: var(--gold);
}

.sidebar-group-items .sidebar-link.active {
    color: var(--gold);
}

/* ── Sidebar Divider ── */
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0.6rem 0.9rem;
}

/* ── Sidebar Overlay (Mobile) ── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ── RESPONSIVE ── */
@media (max-width: 992px) {
    /* "body" raises priority so page files loaded later (family.css,
       profile.css, business.css) can't re-add the 260px sidebar gap */
    body .page-container,
    body .dashboard-page {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .page-container {
        margin-left: 0;
    }
    body.sidebar-open {
        overflow: hidden;
    }
    .top-bar-left .logo {
        font-size: 1rem;
    }
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
    .dashboard-card {
        padding: 1.5rem 1.25rem;
    }
}

@media (max-width: 600px) {
    .dashboard-card {
        padding: 1.25rem 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .stat-item {
        padding: 1rem 0.75rem;
    }
    .stat-item .number {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0 1rem;
        height: 56px;
    }
    body {
        padding-top: 56px;
    }
    .sidebar {
        top: 56px;
        width: 100%;
        max-width: 300px;
    }
    .top-bar-link {
        font-size: 1rem;
    }
    .page-container {
        padding: 6rem 1rem 2rem;
    }
    .dashboard-header h1 {
        font-size: 1.2rem;
    }
    .dashboard-header .email {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-card {
        padding: 1rem 0.75rem;
    }
    .dashboard-card h2 {
        font-size: 1.1rem;
    }
}

/* ── Community Feed (dashboard) — mobile first: tabs; 2+ columns from 760px ── */
.community-feed .cf-intro { margin-bottom: 0.75rem; }
.cf-radio { position: absolute; opacity: 0; pointer-events: none; }
.cf-tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; margin: 0 0 0.75rem; }
.cf-tablabel { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.45rem 0.2rem; border-radius: 10px; border: 1px solid rgba(218, 165, 32, 0.55); background: #fff; font-size: 0.74rem; font-weight: 600; color: var(--charcoal); cursor: pointer; text-align: center; user-select: none; -webkit-tap-highlight-color: transparent; }
.cf-tablabel .cf-ti { font-size: 1.15rem; line-height: 1.2; }
.cf-panel { display: none; }
#cf-tab-community:checked ~ .cf-grid .cf-p-community,
#cf-tab-business:checked ~ .cf-grid .cf-p-business,
#cf-tab-market:checked ~ .cf-grid .cf-p-market,
#cf-tab-invest:checked ~ .cf-grid .cf-p-invest { display: block; }
#cf-tab-community:checked ~ .cf-tabbar .cf-tl-community,
#cf-tab-business:checked ~ .cf-tabbar .cf-tl-business,
#cf-tab-market:checked ~ .cf-tabbar .cf-tl-market,
#cf-tab-invest:checked ~ .cf-tabbar .cf-tl-invest { background: var(--gold); border-color: var(--gold); }
.cf-radio:focus-visible ~ .cf-tabbar { outline: 2px solid var(--terracotta); outline-offset: 3px; border-radius: 10px; }

.cf-panel { background: #fff; border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 10px; padding: 0.9rem 1rem 0.5rem; }
.cf-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.25rem; }
.cf-panel-head h3 { font-family: var(--serif); font-size: 1.02rem; color: var(--charcoal); margin: 0; }
.cf-all { flex: 0 0 auto; font-size: 0.8rem; font-weight: 600; color: var(--terracotta); text-decoration: none; white-space: nowrap; }
.cf-all:hover { text-decoration: underline; }
.cf-list { list-style: none; margin: 0; padding: 0; }
.cf-item { padding: 0.6rem 0; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.cf-item:last-child { border-bottom: none; }
.cf-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--charcoal); font-weight: 600; font-size: 0.95rem; line-height: 1.35; text-decoration: none; overflow-wrap: anywhere; }
.cf-title:hover { color: var(--terracotta); text-decoration: underline; }
.cf-meta { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }
.cf-tag { color: var(--terracotta); font-weight: 600; }
.cf-count { white-space: nowrap; }
.cf-new { display: inline-block; background: var(--gold); color: var(--charcoal); border-radius: 10px; padding: 0 0.45rem; font-size: 0.62rem; font-weight: 700; vertical-align: 1px; }
.cf-empty { font-size: 0.9rem; padding: 0.5rem 0 0.75rem; }
.cf-empty a { color: var(--terracotta); font-weight: 600; }

.cf-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.cf-btn { flex: 0 0 auto; display: inline-block; padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid rgba(218, 165, 32, 0.6); background: #fff; color: var(--charcoal); font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background 0.2s ease; }
.cf-btn:hover { background: rgba(218, 165, 32, 0.15); }
.cf-btn-primary { background: var(--gold); border-color: var(--gold); }
.cf-btn-primary:hover { background: #c8951a; }

/* Wider screens: no tabs, all four panels side by side (2 columns, 4 on very wide) */
@media (min-width: 760px) {
    .cf-tabbar { display: none; }
    .cf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
    .cf-panel, .cf-radio ~ .cf-grid .cf-panel { display: block; }
}
@media (min-width: 1600px) {
    .cf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
