/* StrengthUp Admin: small layer on top of Bootstrap 5.3 (light + dark via data-bs-theme). */

:root {
    --su-accent: #f97316;
    --su-accent-2: #ef4444;
    --su-sidebar-width: 15.5rem;
    --su-radius: .85rem;
}

[data-bs-theme="light"] {
    --su-page-bg: #f4f6fa;
    --su-sidebar-bg: #111827;
    --su-sidebar-fg: #cbd5e1;
    --su-sidebar-active: rgba(255, 255, 255, .09);
    --su-card-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

[data-bs-theme="dark"] {
    --su-page-bg: #0d1117;
    --su-sidebar-bg: #0a0d12;
    --su-sidebar-fg: #aab4c3;
    --su-sidebar-active: rgba(255, 255, 255, .07);
    --su-card-shadow: none;
}

body { background: var(--su-page-bg); }

.min-w-0 { min-width: 0; }
.mw-cell { max-width: 18rem; }
.text-pre { white-space: pre-wrap; }

/* ---------- shell ---------- */

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    /* !important: Bootstrap's .offcanvas-lg forces a transparent background on wide screens. */
    background-color: var(--su-sidebar-bg) !important;
    color: var(--su-sidebar-fg);
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .sidebar {
        width: var(--su-sidebar-width);
        position: sticky;
        top: 0;
        height: 100vh;
        flex-shrink: 0;
    }
}

@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { width: var(--su-sidebar-width); }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: .6rem;
    color: #fff;
    background: linear-gradient(135deg, var(--su-accent), var(--su-accent-2));
    box-shadow: 0 4px 14px rgba(249, 115, 22, .35);
}

.brand-mark-lg { width: 3.25rem; height: 3.25rem; font-size: 1.5rem; border-radius: .9rem; }

.brand-text { color: #fff; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { color: var(--su-sidebar-fg); font-weight: 500; }

.sidebar-nav { padding: .5rem .75rem; flex: 1; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--su-sidebar-fg);
    padding: .6rem .8rem;
    border-radius: .55rem;
    margin-bottom: .15rem;
    background: none;
    border: 0;
    font-size: .95rem;
}

.sidebar .nav-link:hover { color: #fff; background: var(--su-sidebar-active); }

.sidebar .nav-link.active {
    color: #fff;
    background: var(--su-sidebar-active);
    box-shadow: inset 3px 0 0 var(--su-accent);
}

.sidebar .nav-link i { font-size: 1.1rem; width: 1.2rem; text-align: center; }

.sidebar-footer {
    padding: .75rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

/* Page theme lives on <html>; the sidebar itself is always data-bs-theme="dark". */
html[data-bs-theme="light"] .theme-icon-light,
html[data-bs-theme="dark"] .theme-icon-dark { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.content { padding: 1.5rem; max-width: 1400px; width: 100%; }

@media (min-width: 1200px) { .content { padding: 2rem 2.5rem; } }

/* ---------- page header ---------- */

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

.page-header h1 { font-size: 1.6rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-header p { margin: .2rem 0 0; color: var(--bs-secondary-color); }

.search-form { min-width: min(100%, 22rem); }
.date-input { max-width: 11rem; }

/* ---------- cards ---------- */

.card {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--su-radius);
    box-shadow: var(--su-card-shadow);
}

.card > .card-header {
    background: transparent;
    font-weight: 600;
    padding: .9rem 1.1rem;
}

.card > .card-header i { color: var(--bs-secondary-color); margin-right: .25rem; }

.card > .card-footer { background: transparent; padding: .75rem 1.1rem; }

.table > :not(caption) > * > * { padding: .75rem 1rem; }
.table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
    font-weight: 600;
    background: var(--bs-tertiary-bg);
}

/* ---------- stat cards ---------- */

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--su-radius);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    box-shadow: var(--su-card-shadow);
    height: 100%;
}

.stat-card > i {
    display: inline-grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: .75rem;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { font-size: .85rem; color: var(--bs-secondary-color); }

.stat-primary > i { color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.stat-success > i { color: var(--bs-success); background: var(--bs-success-bg-subtle); }
.stat-info > i { color: var(--bs-info-text-emphasis); background: var(--bs-info-bg-subtle); }
.stat-warning > i { color: var(--bs-warning-text-emphasis); background: var(--bs-warning-bg-subtle); }
.stat-subtle > i { color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); }

/* ---------- users ---------- */

.user-badge { display: inline-flex; align-items: center; gap: .65rem; color: inherit; max-width: 100%; }
.user-badge:hover .fw-semibold { color: var(--bs-primary); }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    flex-shrink: 0;
}

.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.15rem; }

/* ---------- details ---------- */

.section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    margin: 0 0 .75rem;
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(8rem, 40%) 1fr;
    gap: .45rem 1rem;
    margin-bottom: 1.5rem;
}

.detail-list dt { font-weight: 500; color: var(--bs-secondary-color); }
.detail-list dd { margin: 0; word-break: break-word; }

.exercise-list { list-style: none; padding: 0; margin: 0; counter-reset: ex; }

.exercise-list > li {
    counter-increment: ex;
    position: relative;
    padding: .75rem 0 .75rem 2.25rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.exercise-list > li:last-child { border-bottom: 0; }

.exercise-list > li::before {
    content: counter(ex);
    position: absolute;
    left: 0;
    top: .8rem;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 700;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}

.set-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }

.set-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .55rem .2rem .25rem;
    border-radius: 2rem;
    font-size: .8rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.set-chip-muted { background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }

.set-no {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    font-size: .7rem;
    font-weight: 700;
    background: var(--bs-body-bg);
}

.set-type { font-size: .7rem; opacity: .8; text-transform: uppercase; letter-spacing: .03em; }

/* Exercise notes are often the full instructions: show two lines, full text on hover. */
.exercise-notes {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- empty / loading ---------- */

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.empty-state > i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.empty-state p { margin-bottom: .75rem; }

.loading { display: flex; justify-content: center; padding: 2.5rem; }

/* ---------- login ---------- */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background:
        radial-gradient(60rem 30rem at 10% -10%, rgba(249, 115, 22, .14), transparent 60%),
        radial-gradient(50rem 30rem at 110% 110%, rgba(99, 102, 241, .16), transparent 60%),
        var(--su-page-bg);
}

.login-card { width: 100%; max-width: 25rem; }

.nav-tabs .nav-link { color: var(--bs-secondary-color); }
.nav-tabs .nav-link.active { font-weight: 600; color: var(--bs-body-color); }
.nav-tabs .badge { font-weight: 500; }
