/* =============================================================
   ClayBot — App-wide styles
   Loaded globally in layouts/main.php.
   Page-specific styles live in their own files under assets/css/pages/.
   ============================================================= */

/* ── Base ────────────────────────────────────────────────── */
body { background-color: #f4f7fb; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar-brand img {
    border-radius: 50%;
    object-fit: cover;
}

/* ── Shared App Sidebar ──────────────────────────────────── */
.app-sidebar {
    background: linear-gradient(160deg, #1a2a3a 0%, #1e3a5f 100%);
    min-height: 100vh;
    padding: 24px 18px;
    color: #e2ecf7;
    position: sticky;
    top: 0;
}
.app-sidebar .user-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.22);
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.app-sidebar .user-name {
    font-size: .92rem;
    font-weight: 700;
    color: #fff;
    margin-top: 8px;
}
.app-sidebar .balance-badge {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .74rem;
    color: #7dd3fc;
    display: inline-block;
    margin-top: 4px;
}
.app-sidebar hr {
    border-color: rgba(255,255,255,.12);
    margin: 12px 0;
}

/* ── Sidebar nav links ───────────────────────────────────── */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 9px;
    color: #c9ddf0;
    text-decoration: none;
    font-size: .87rem;
    transition: background .16s, color .16s;
    margin-bottom: 2px;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.sidebar-nav a .nav-icon {
    width: 22px;
    text-align: center;
    font-size: 1rem;
}

/* ── Sidebar logout link ─────────────────────────────────── */
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f87171;
    font-size: .87rem;
    padding: 8px 11px;
    border-radius: 9px;
    text-decoration: none;
    transition: background .16s;
}
.sidebar-logout:hover {
    background: rgba(248,113,113,.12);
    color: #fca5a5;
}

/* ── Sidebar info card ───────────────────────────────────── */
.sidebar-card {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: .82rem;
    color: #a8c8e8;
    margin-bottom: 10px;
}
.sidebar-card .sc-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: rgba(255,255,255,.4);
    margin-bottom: 1px;
}
.sidebar-card .sc-value {
    color: #e2ecf7;
    font-weight: 600;
    font-size: .84rem;
}

/* ── Sidebar mini-stat boxes ─────────────────────────────── */
.sidebar-stat-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.sidebar-stat-box {
    flex: 1;
    background: rgba(255,255,255,.08);
    border-radius: 9px;
    padding: 8px 6px;
    text-align: center;
    font-size: .78rem;
    color: #a8c8e8;
}
.sidebar-stat-box .s-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

/* ── Sidebar labels & tags ───────────────────────────────── */
.sidebar-section-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.35);
    margin-bottom: 6px;
}
.sidebar-tag {
    display: inline-block;
    background: rgba(255,255,255,.1);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: .76rem;
    color: #bfdbfe;
    margin: 2px 2px 2px 0;
}

/* ── Settings tab pills (inside sidebar) ─────────────────── */
.sidebar-pills {
    gap: 2px;
}
.sidebar-pills .nav-link,
.sidebar-pills .nav-link:focus,
.sidebar-pills .nav-link:focus-visible {
    color: #c9ddf0;
    background: transparent;
    font-size: .87rem;
    border-radius: 9px;
    padding: 9px 12px;
    text-align: left;
    border: 1px solid transparent;
    transition: background .16s, border-color .16s, color .16s;
    box-shadow: none;
    outline: none;
}
.sidebar-pills .nav-link:hover {
    background: rgba(255,255,255,.09);
    border-color: rgba(255,255,255,.1);
    color: #fff;
}
.sidebar-pills .nav-link.active,
.sidebar-pills .show > .nav-link {
    background: rgba(255,255,255,.16) !important;
    border-color: rgba(255,255,255,.2) !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.18) !important;
}
.sidebar-pill-btn { width: 100%; }

/* ── Main content area ───────────────────────────────────── */
.main-content { padding: 28px 26px; }

.page-header {
    border-bottom: 2px solid #e8edf3;
    padding-bottom: 12px;
    margin-bottom: 24px;
}
.page-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}

/* ── Mobile top bar ──────────────────────────────────────── */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 200;
    background: linear-gradient(90deg, #1a2a3a 0%, #1e3a5f 100%);
    padding: 10px 16px;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.mobile-topbar .sidebar-toggle-btn {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .16s;
}
.mobile-topbar .sidebar-toggle-btn:hover { background: rgba(255,255,255,.22); }
.mobile-topbar .mobile-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex: 1;
}
.mobile-topbar .mobile-logo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.25);
}

/* ── Sidebar overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1040;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Sidebar close button (mobile only) ──────────────────── */
.sidebar-close-btn {
    display: none;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: #c9ddf0;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: .82rem;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    transition: background .16s;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ── Responsive breakpoints ──────────────────────────────── */
@media (max-width: 767px) {

    /* Show mobile bar */
    .mobile-topbar { display: flex; }

    /* Sidebar becomes a fixed off-canvas drawer */
    .app-sidebar {
        display: none;
        position: fixed !important;
        top: 0;
        left: 0;
        width: 285px;
        height: 100vh;
        z-index: 1050;
        overflow-y: auto;
        min-height: unset;
        padding-top: 18px;
        box-shadow: 4px 0 24px rgba(0,0,0,.35);
    }
    .app-sidebar.sidebar-open { display: block; }

    /* Show close button inside sidebar */
    .sidebar-close-btn { display: inline-flex; }

    /* Main content fills full width */
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 16px 14px;
    }

    /* Prevent body scroll when drawer is open */
    body.sidebar-is-open { overflow: hidden; }

    /* Tighter stat cards on mobile */
    .stat-card   { padding: 14px 12px; gap: 10px; }
    .stat-icon   { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-val    { font-size: 1.3rem; }
    .stat-lbl    { font-size: .75rem; }

    /* Section header wraps on narrow screens */
    .section-header { flex-wrap: wrap; gap: 8px; }

    /* Account card adjustments */
    .account-card-header { padding: 14px 14px 12px; }
    .account-card-body   { padding: 12px 14px; }
    .account-card-footer { padding: 10px 14px; }

    /* Page header */
    .page-header h2 { font-size: 1.1rem; }
}

@media (min-width: 768px) {
    /* Always show sidebar as normal column on tablet+ */
    .app-sidebar { display: block !important; position: sticky !important; }
    /* Hide mobile-only elements */
    .sidebar-overlay { display: none !important; }
    .sidebar-close-btn { display: none !important; }
}
