/* Frontline Forge dashboard — theme aligned with Concours Armée (Airwallex-style) */

:root {
    --dash-bg-page: #f7f8fa;
    --dash-bg-card: #ffffff;
    --dash-sidebar-bg: #141414;
    --dash-sidebar-text: #e8e8e8;
    --dash-sidebar-muted: #8a8a8a;
    --dash-accent: #e85d4c;
    --dash-accent-soft: #6b4c9a;
    --dash-header-border: #e8eaef;
    --dash-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
    --dash-radius: 12px;
    --dash-radius-sm: 8px;
    --dash-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --dash-page-max: 1400px;
    --dash-sidebar-width: 260px;
    --dash-header-offset: 61px;
    --dash-main-pad-top: 24px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--dash-font);
    background: var(--dash-bg-page);
    color: #1a1a1a;
    min-height: 100%;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--dash-bg-card);
    border-bottom: 1px solid var(--dash-header-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.dash-header__brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-header__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #111827;
}

.dash-header__title a {
    color: #111827;
    text-decoration: none;
}

.dash-header__title-ff {
    color: #111827;
}

.dash-header__tagline {
    font-size: 0.75rem;
    color: #6b7280;
}

.dash-header__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Do not set display:flex on these wrappers without :not([hidden]) — it overrides the HTML hidden attribute. */
.dash-header__guest[hidden],
.dash-header__user[hidden] {
    display: none !important;
}

.dash-header__guest:not([hidden]),
.dash-header__user:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-header__email {
    font-size: 0.875rem;
    color: #4b5563;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-btn {
    border: 1px solid #d1d5db;
    border-radius: var(--dash-radius-sm);
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.dash-btn:hover {
    background: #f9fafb;
    border-color: #c4c8d0;
}

.dash-btn--primary {
    background: var(--dash-accent-soft);
    border-color: var(--dash-accent-soft);
    color: #fff;
}

.dash-btn--primary:hover {
    filter: brightness(1.06);
    border-color: var(--dash-accent-soft);
}

.dash-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dash-accent-soft), #9b7ec4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.dash-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--dash-header-offset));
    flex-direction: row;
    width: 100%;
    max-width: none;
    margin: 0;
}

.dash-main {
    flex: 1;
    min-width: 0;
    padding: 24px 28px 48px;
}

.dash-main > .view-panel {
    max-width: var(--dash-page-max);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.dash-sidebar {
    width: var(--dash-sidebar-width);
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: var(--dash-header-offset);
    min-height: calc(100vh - var(--dash-header-offset));
    max-height: calc(100vh - var(--dash-header-offset));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 50;
    background: var(--dash-sidebar-bg);
    color: var(--dash-sidebar-text);
    padding: 20px 0 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2a2a2a;
}

.dash-sidebar__label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dash-sidebar-muted);
    padding: 0 20px 8px;
    margin-top: 12px;
}

.dash-sidebar__label:first-child {
    margin-top: 0;
}

.dash-nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--dash-sidebar-text);
    font-size: 0.9rem;
    cursor: pointer;
    gap: 10px;
    transition: background 0.12s, color 0.12s;
}

.dash-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.dash-nav-item.active {
    color: var(--dash-accent);
    background: rgba(232, 93, 76, 0.08);
}

.dash-nav-item[hidden] {
    display: none !important;
}

.dash-nav-item__icon {
    width: 18px;
    text-align: center;
    opacity: 0.85;
    font-size: 0.95rem;
}

.dash-nav-item__icon--svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-nav-item__icon--svg svg {
    display: block;
    flex-shrink: 0;
}

/* ——— Dropdown sidebar (Concours Armée-style) ——— */
.dash-nav-details {
    margin: 0;
    padding: 0;
}

.dash-nav-details > summary {
    list-style: none;
}

.dash-nav-details > summary::-webkit-details-marker {
    display: none;
}

.dash-nav-summary {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    cursor: pointer;
    user-select: none;
    gap: 10px;
    color: var(--dash-sidebar-text);
    font-size: 0.9rem;
    transition: background 0.12s, color 0.12s;
}

.dash-nav-summary:hover {
    background: rgba(255, 255, 255, 0.06);
}

.dash-nav-summary.active-parent {
    color: var(--dash-accent);
    background: rgba(232, 93, 76, 0.08);
}

.dash-nav-summary__label {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.dash-nav-chevron {
    font-size: 0.65rem;
    opacity: 0.7;
    transition: transform 0.2s;
    display: block;
}

.dash-nav-details[open] .dash-nav-chevron {
    transform: rotate(180deg);
}

.dash-nav-sub {
    padding: 4px 0 8px 0;
    display: none;
    flex-direction: column;
}

.dash-nav-details[open] .dash-nav-sub {
    display: flex;
}

.dash-nav-sub a {
    display: block;
    padding: 8px 20px 8px 48px;
    font-size: 0.82rem;
    color: var(--dash-sidebar-muted);
    text-decoration: none;
    transition: color 0.12s, background 0.12s;
}

.dash-nav-sub a:hover {
    color: var(--dash-sidebar-text);
    background: rgba(255, 255, 255, 0.04);
}

.dash-nav-sub a.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

.dash-nav-sub a.active {
    color: var(--dash-accent);
    font-weight: 600;
    background: rgba(232, 93, 76, 0.08);
}

.dash-sidebar__footer {
    margin-top: auto;
    padding: 20px;
    font-size: 0.7rem;
    color: var(--dash-sidebar-muted);
    border-top: 1px solid #2a2a2a;
}

.view-panel {
    display: none;
    animation: ffDashFade 0.25s ease;
}

.view-panel.active {
    display: block;
}

.view-panel--locked {
    display: none !important;
}

/* Active tab stays visible while offer data is still loading */
.view-panel.active.view-panel--locked {
    display: block !important;
}

@keyframes ffDashFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.content-card {
    background: var(--dash-bg-card);
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow-card);
    overflow: hidden;
    margin-bottom: 20px;
}

.content-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #eef0f4;
}

.content-card__head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
}

.content-card__body {
    padding: 24px;
}

.content-card__body--flush {
    padding: 0;
}

.content-card__lead {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: #6b7280;
    max-width: 60ch;
    line-height: 1.5;
}

.test-card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.test-card-grid--psych {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 640px) {
    .test-card-grid--psych {
        grid-template-columns: 1fr;
    }
}

.test-card-grid--psych .test-card {
    flex: none;
    max-width: none;
    min-height: 140px;
    padding: 22px 24px;
}

.test-card__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.test-card__icon {
    position: relative;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dash-accent);
    opacity: 0.92;
}

.test-card__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.test-card {
    flex: 1 1 200px;
    max-width: 280px;
    min-height: 100px;
    padding: 18px 20px;
    border-radius: var(--dash-radius-sm);
    border: 1px solid #e8eaef;
    background: #fafbfc;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.test-card.test-card--psych {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.test-card.test-card--psych:hover .test-card__icon {
    opacity: 1;
    color: #d44a3a;
}

.test-card:hover {
    border-color: var(--dash-accent-soft);
    box-shadow: 0 4px 14px rgba(107, 76, 154, 0.12);
    transform: translateY(-1px);
}

.test-card__title {
    font-weight: 650;
    font-size: 0.95rem;
}

.test-card__desc {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #4b5563;
    flex: 1;
}

.test-card--psych .test-card__desc {
    flex: 0 1 auto;
}

.test-card__meta {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: auto;
    padding-top: 4px;
}

.test-card--psych .test-card__main .test-card__meta {
    margin-top: 6px;
}

.placeholder-view {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 42ch;
    margin: 0 auto;
}

.ff-stats-section {
    margin-bottom: 28px;
}

.ff-stats-section:last-child {
    margin-bottom: 0;
}

.ff-stats-section h3 {
    margin: 0 0 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

/* ——— Stats table + diagram (legacy behavior) ——— */
.stats-container {
    width: 100%;
    overflow-x: auto;
}

.points-box {
    width: 130px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    float: right;
}

.last-score {
    width: 60px;
    height: 35px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color, #1b2a4a);
    border-radius: 8px;
    color: var(--color, #1b2a4a);
}

.points-box .point {
    width: 100%;
    height: 100%;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.points-box .point.low {
    --color: #dc2626;
    border: 1px solid var(--color);
    border-right: none;
    color: var(--color);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.points-box .point.average {
    --color: #16a34a;
    background: var(--color);
    color: white;
    font-weight: bold;
    border-radius: 0;
}

.points-box .point.high {
    --color: #1b2a4a;
    border: 1px solid var(--color);
    border-left: none;
    color: var(--color);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.stats-container td.name a {
    max-width: 200px;
    display: inline-block;
    color: #111827;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}

.stats-container td.name a:hover {
    border-bottom-color: var(--dash-accent-soft);
    color: var(--dash-accent-soft);
}

.stats-container .played {
    text-align: right;
    color: #6b7280;
}

.stats-container table .title .small {
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-container table .title .main {
    font-weight: 700;
    font-size: 22px;
    color: #1b2a4a;
}

.stats-container table .title {
    display: flex;
    flex-direction: column;
    justify-content: right;
    align-items: flex-end;
}

.stats-container table {
    width: 100%;
    border-spacing: 10px;
}

.stat-details h3 {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.stat-details {
    height: 400px;
    width: 100%;
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 30px;
}

.stat-row {
    display: none;
}

.stat-row.active {
    display: table-row;
}

.stat-details .list .entry .scores .score-relative {
    width: 50px;
    padding: 4px;
    color: white;
    text-align: center;
    border-radius: 5px;
}

.stat-details .list .entry .scores .score {
    color: #111827;
}

.stat-details .list .entry .scores {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-details .list .entry:nth-child(2n) {
    background-color: #f8fafc;
}

.stat-details .list .entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: #6b7280;
    font-weight: 500;
}

.stat-details .list {
    width: 50%;
    height: 100%;
    overflow-y: auto;
}

.stat-details .diagram .dot {
    position: absolute;
    top: calc(var(--y) * 100%);
    left: calc(var(--x) * 100%);
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: ffGrow 500ms forwards;
}

@keyframes ffGrow {
    from {
        transform: translate(-100%, -50%) scale(0, 0);
    }
    to {
        transform: translate(-100%, -50%) scale(1, 1);
    }
}

.stat-details .diagram-container {
    width: 50%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.stat-details .diagram {
    height: 100%;
    background: linear-gradient(to bottom, #e5e7eb 1px, white 1px);
    border-bottom: 1px solid #9ca3af;
    background-size: 100% 10%;
    position: relative;
    width: calc(100% - 40px);
    margin-left: 40px;
    z-index: 99;
}

.diagram-labels {
    width: calc(100% - 40px);
    margin-left: 40px;
    position: relative;
    height: 1lh;
}

.label {
    position: absolute;
    background: #9ca3af;
}

.label-horizontal {
    height: 0;
    width: 0;
}

.label-vertical {
    height: 5px;
    width: 1px;
}

.label::after {
    content: var(--label);
    color: #9ca3af;
    position: absolute;
    top: 50%;
    font-size: 12px;
    font-weight: 700;
    display: block;
}

.label-horizontal::after {
    transform: translateY(-0.5lh);
    right: calc(100% + 6px);
}

.label-vertical::after {
    transform: translateX(50%) translateY(2px);
    right: 0;
}

/* ——— Auth modal (dashboard guest-first) ——— */
.ff-dash-auth-dialog {
    max-width: calc(100vw - 32px);
    width: 420px;
    padding: 0;
    border: none;
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow-card), 0 12px 40px rgba(0, 0, 0, 0.12);
}

.ff-dash-auth-dialog::backdrop {
    background: rgba(15, 15, 20, 0.45);
}

.ff-dash-auth-dialog__inner {
    position: relative;
    padding: 24px 24px 22px;
}

.ff-dash-auth-dialog__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.ff-dash-auth-dialog__close:hover {
    background: #f3f4f6;
    color: #111;
}

.ff-dash-auth-dialog__title {
    margin: 0 32px 8px 0;
    font-size: 1.2rem;
    font-weight: 650;
}

.ff-dash-auth-dialog__hint {
    margin: 0 0 16px;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.45;
}

.ff-dash-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 1px solid #e8eaef;
}

.ff-dash-auth-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.ff-dash-auth-tab--active {
    color: var(--dash-accent);
    border-bottom-color: var(--dash-accent);
}

.ff-dash-auth-panel {
    display: none;
}

.ff-dash-auth-panel.ff-dash-auth-panel--active {
    display: block;
}

.ff-dash-auth-reset[hidden] {
    display: none !important;
}

.ff-dash-auth-reset:not([hidden]) {
    display: block;
}

.ff-dash-auth-field {
    margin-bottom: 14px;
}

.ff-dash-auth-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.ff-dash-auth-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: var(--dash-radius-sm);
    font-size: 0.95rem;
}

.ff-dash-auth-forgot {
    margin: 0 0 14px;
}

.ff-dash-auth-linkbtn {
    border: none;
    background: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--dash-accent-soft);
    text-decoration: underline;
    cursor: pointer;
}

.ff-dash-auth-submit {
    width: 100%;
    margin-top: 4px;
}

.ff-dash-auth-err {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--dash-radius-sm);
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.875rem;
}

.ff-dash-auth-success {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--dash-radius-sm);
    background: #ecfdf5;
    color: #065f46;
    font-size: 0.875rem;
}

.ff-dash-auth-recaptcha {
    margin: 12px 0;
}

.ff-dash-auth-recaptcha-msg {
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: #92400e;
}

@media (max-width: 900px) {
    :root {
        --dash-main-pad-top: 16px;
    }

    .dash-layout {
        flex-direction: column;
    }

    .dash-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid #2a2a2a;
        min-height: 0;
        max-height: min(52vh, calc(100vh - var(--dash-header-offset)));
    }

    .dash-sidebar__label {
        width: 100%;
        padding: 8px 12px 4px;
    }

    .dash-nav-item {
        padding: 8px 12px;
        width: auto;
        flex: 1 1 auto;
    }

    .dash-sidebar__footer {
        width: 100%;
        text-align: center;
    }

    .dash-main {
        padding: 16px;
    }

    .dash-header__email {
        display: none;
    }
}
