/*
 * Account area ("My Links", "My Account", "My Tools", "My Finance", "My Network")
 * enterprise design system. Reuses the site's existing member-area accent
 * (linear-gradient(135deg, #667eea 0%, #764ba2 100%) — already used by the
 * sidebar active nav state, the club modal header, and the network tree
 * stat cards) and the global .card radius/shadow. Functional buttons keep
 * Bootstrap's theme-aware .btn-primary/.btn-success/etc — this file never
 * overrides those.
 *
 * All rules are scoped under .account-page / .account-sidebar so nothing
 * bleeds into unrelated pages.
 */

.account-page {
    --acct-accent-start: #667eea;
    --acct-accent-end: #764ba2;
    --acct-accent-gradient: linear-gradient(135deg, var(--acct-accent-start) 0%, var(--acct-accent-end) 100%);
    --acct-border: #eef0f5;
    --acct-muted: #6b7280;
    --acct-ink: #111827;
}

/* ---------- Page header ---------- */
.account-page .acct-page-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-page .acct-page-header__icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--acct-accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

.account-page .acct-page-header__body {
    flex: 1 1 auto;
    min-width: 0;
}

.account-page .acct-page-header__body h4 {
    font-weight: 700;
    color: var(--acct-ink);
    margin-bottom: 0.2rem;
}

.account-page .acct-page-header__body p {
    margin-bottom: 0;
}

.account-page .acct-page-header__action {
    margin-left: auto;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .account-page .acct-page-header__action {
        margin-left: 0;
        width: 100%;
    }

    .account-page .acct-page-header__action .btn {
        width: 100%;
    }
}

/* ---------- Stat tiles ---------- */
.account-page .acct-stat-tile {
    border: 1px solid var(--acct-border);
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.account-page .acct-stat-tile__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--acct-accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.account-page .acct-stat-tile__body {
    min-width: 0;
    flex: 1 1 auto;
}

.account-page .acct-stat-tile__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--acct-muted);
    margin-bottom: 0.2rem;
}

.account-page .acct-stat-tile__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--acct-ink);
    line-height: 1.15;
}

.account-page .acct-stat-tile__action {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* ---------- Action / navigation cards ---------- */
.account-page .acct-action-card {
    border: 1px solid var(--acct-border);
    border-radius: 12px;
    background: #fff;
    padding: 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.account-page .acct-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09);
}

.account-page .acct-action-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--acct-accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.85rem;
    flex-shrink: 0;
}

.account-page .acct-action-card__title {
    font-weight: 600;
    color: var(--acct-ink);
    margin-bottom: 0.35rem;
}

.account-page .acct-action-card__desc {
    color: var(--acct-muted);
    font-size: 0.88rem;
    flex: 1 1 auto;
    margin-bottom: 1rem;
}

.account-page .acct-action-card__footer {
    margin-top: auto;
}

/* ---------- Link (copy) cards ---------- */
.account-page .acct-link-card {
    border: 1px solid var(--acct-border);
    border-radius: 12px;
    background: #fff;
    padding: 1.1rem 1.25rem;
    height: 100%;
}

.account-page .acct-link-card__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--acct-ink);
    margin-bottom: 0.35rem;
}

.account-page .acct-link-card__label .acct-link-card__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--acct-accent-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.account-page .acct-link-card__desc {
    color: var(--acct-muted);
    font-size: 0.85rem;
    margin-bottom: 0.65rem;
}

.account-page .acct-link-card .input-group .form-control {
    background: #f8f9fa;
}

/* ---------- Form sections (My Account) ---------- */
.account-page .acct-form-section {
    margin-bottom: 2rem;
}

.account-page .acct-form-section:last-child {
    margin-bottom: 0.5rem;
}

.account-page .acct-form-section__title {
    font-size: 1rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f2f6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-page .acct-form-section__title i {
    color: var(--acct-accent-start);
}

/* Gradient pill tabs */
.account-page .acct-pill-tabs {
    border-bottom: none;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.account-page .acct-pill-tabs .nav-link {
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    color: #4b5563;
    font-weight: 600;
    transition: all 0.15s ease;
}

.account-page .acct-pill-tabs .nav-link:hover {
    border-color: var(--acct-accent-start);
    color: var(--acct-accent-start);
}

.account-page .acct-pill-tabs .nav-link.active {
    background: var(--acct-accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

/* ---------- Empty states ---------- */
.account-page .acct-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--acct-muted);
}

.account-page .acct-empty i {
    font-size: 1.75rem;
    margin-bottom: 0.6rem;
    display: block;
    color: #d1d5db;
}

/* ---------- Responsive transaction tables ---------- */
/* Desktop: normal table. Below 768px: each row becomes a labeled stacked card. */
@media (max-width: 767.98px) {
    .account-page .acct-table-responsive table,
    .account-page .acct-table-responsive thead,
    .account-page .acct-table-responsive tbody,
    .account-page .acct-table-responsive th,
    .account-page .acct-table-responsive td,
    .account-page .acct-table-responsive tr {
        display: block;
        width: 100%;
    }

    .account-page .acct-table-responsive thead {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .account-page .acct-table-responsive tbody tr {
        margin-bottom: 0.75rem;
        border: 1px solid var(--acct-border);
        border-radius: 10px;
        padding: 0.65rem 0.85rem;
    }

    .account-page .acct-table-responsive tbody tr:last-child {
        margin-bottom: 0;
    }

    .account-page .acct-table-responsive td {
        border: none;
        padding: 0.4rem 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        text-align: right;
    }

    .account-page .acct-table-responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--acct-muted);
        text-align: left;
        margin-right: auto;
    }

    .account-page .acct-table-responsive td.acct-td-block {
        display: block;
        text-align: left;
        padding-top: 0.5rem;
    }

    .account-page .acct-table-responsive td.acct-td-block::before {
        display: block;
        margin-bottom: 0.35rem;
    }

    .account-page .acct-table-responsive td:empty {
        display: none;
    }
}

/* ---------- My Network: stat cards + tree (moved out of the page template) ---------- */
.account-page .tree-container {
    max-height: 800px;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.account-page .stat-card {
    border: 1px solid var(--acct-border);
    border-radius: 0.75rem;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.account-page .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--acct-accent-gradient);
    color: #ffffff;
    font-size: 1rem;
}

.account-page .stat-content .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 4px;
}

.account-page .stat-content .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.account-page .tree-node {
    position: relative;
}

.account-page .tree-root {
    display: flex;
    flex-direction: column;
}

.account-page .tree-node-content {
    display: grid;
    grid-template-columns: 22px 42px 1fr auto;
    align-items: center;
    column-gap: 16px;
    background: white;
    border: 1px solid var(--acct-border);
    border-left: 4px solid transparent;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(16, 19, 26, 0.03);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.account-page .tree-node-content:hover {
    box-shadow: 0 4px 14px -6px rgba(16, 19, 26, 0.18);
    border-color: #d7dbe3;
}

.account-page .tree-node-children {
    margin-left: 27px;
    margin-top: 8px;
    padding-left: 20px;
    border-left: 2px dashed #d9dde6;
    display: none;
}

.account-page .tree-node-children.expanded {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-page .tree-toggle {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--acct-border);
    border: 1px solid var(--acct-border);
    color: var(--acct-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.account-page .tree-toggle-spacer {
    width: 22px;
    height: 22px;
    display: inline-block;
    flex-shrink: 0;
}

.account-page .tree-toggle:hover {
    background: #e2e5eb;
}

.account-page .tree-toggle.expanded {
    background: var(--acct-ink);
    border-color: var(--acct-ink);
    color: white;
}

.account-page .tree-toggle i {
    font-size: 11px;
}

.account-page .tree-node-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.86rem;
    flex-shrink: 0;
}

.account-page .tree-node-info {
    min-width: 0;
}

.account-page .tree-node-top {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 4px;
}

.account-page .tree-node-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--acct-ink);
}

.account-page .tn-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 9px;
    border-radius: 999px;
    line-height: 1.5;
    white-space: nowrap;
}

.account-page .tn-pill-me {
    background: var(--acct-border);
    color: #374151;
}

.account-page .tree-node-meta {
    font-size: 0.81rem;
    color: var(--acct-muted);
}

.account-page .tn-dot {
    color: #cbd0da;
    margin: 0 10px;
}

.account-page .tree-node-status-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    text-align: right;
}

.account-page .tn-status-pill {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.account-page .tn-status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.account-page .tn-status-active {
    background-color: #e3f8ea;
    color: #157347;
}

.account-page .tn-status-inactive {
    background-color: #fdeaea;
    color: #c22929;
}

.account-page .tn-status-neutral {
    background-color: #eef0f4;
    color: #6b7280;
}

.account-page .tn-paid-until {
    font-size: 0.72rem;
    color: #9aa2b1;
    white-space: nowrap;
}

.account-page .tree-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.account-page .tree-empty {
    padding: 10px;
    color: #6c757d;
    font-style: italic;
}

.account-page .highlight {
    box-shadow: 0 0 0 2px #fbbf24 inset;
    background-color: #fffbeb !important;
}

@media (max-width: 767.98px) {
    .account-page .tree-container {
        padding: 12px;
    }

    .account-page .tree-node-children {
        margin-left: 14px;
        padding-left: 12px;
    }

    .account-page .tree-node-content {
        grid-template-columns: 20px 38px 1fr;
        row-gap: 10px;
        padding: 12px 14px;
    }

    .account-page .tree-node-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.8rem;
    }

    .account-page .tree-node-status-col {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding-top: 10px;
        margin-top: 2px;
        border-top: 1px dashed var(--acct-border);
    }

    .account-page .tree-node-content:hover {
        box-shadow: 0 1px 2px rgba(16, 19, 26, 0.03);
    }

    .account-page .acct-tree-controls {
        text-align: left !important;
    }

    .account-page .acct-tree-controls .btn {
        width: 100%;
        margin: 0 0 0.5rem 0 !important;
    }

    .account-page .acct-tree-controls .btn:last-child {
        margin-bottom: 0 !important;
    }
}

/* ---------- Sidebar (shared account chrome) ---------- */
.account-sidebar {
    display: flex;
    flex-direction: column;
}

.account-sidebar .account-sidebar-body {
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .account-sidebar {
        height: calc(100vh - 180px);
        position: sticky;
        top: 20px;
    }

    .account-sidebar .account-sidebar-body {
        flex: 1;
        overflow-y: auto;
    }
}

@media (max-width: 991.98px) {
    .account-sidebar {
        height: auto;
        position: static;
        margin-bottom: 1.5rem;
    }

    .account-sidebar .account-sidebar-body {
        overflow-y: visible;
    }
}
