/* ============================================================
   Whendl brand override for Bootstrap 5.3
   Hooks into Bootstrap's native [data-bs-theme] color modes rather
   than building a parallel theme system — every Bootstrap component
   (forms, alerts, buttons, etc.) gets dark-mode-aware styling for
   free; we just override the color values it uses.
   ============================================================ */

/* ── Whendl-specific tokens (not part of Bootstrap's own variable set) ── */
:root {
    --whendl-brand: #8C5575;          /* header bar — constant across themes */
    --whendl-brand-accent: #63314E;   /* header button circles — constant */
    --whendl-brand-secondary: #6A88BF;
    --whendl-status-running: #26D900;
    --whendl-status-paused: #FF5F00;
    --whendl-status-stopped: #FF0000;
    --whendl-status-pending: #6A88BF; /* reuses the brand secondary blue */
}

/* ── Light mode (default) ── */
[data-bs-theme="light"] {
    --bs-body-bg: #F1F1F1;
    --bs-body-color: #1A1A1A;
    --bs-border-color: #989898;
    --bs-primary: #8C5575;
    --bs-primary-rgb: 140, 85, 117;
    --bs-link-color: #8C5575;
    --bs-link-hover-color: #63314E;
    --bs-secondary-color: #5A5A5A;
    --bs-tertiary-bg: #D3D3D3;        /* raised surface — cards, popovers */
    --bs-emphasis-color: #000000;

    --whendl-surface: #D3D3D3;
    --whendl-header-glyph: #63314E;
    --whendl-header-glyph-hover: #FFFFFF;
}

/* ── Dark mode ── */
[data-bs-theme="dark"] {
    --bs-body-bg: #131312;
    --bs-body-color: #EDEDED;
    --bs-border-color: #4A4A4A;
    --bs-primary: #8C5575;
    --bs-primary-rgb: 140, 85, 117;
    --bs-link-color: #C79CB8;
    --bs-link-hover-color: #E4C4D8;
    --bs-secondary-color: #A9A8A8;
    --bs-tertiary-bg: #383838;        /* raised surface — cards, popovers */
    --bs-emphasis-color: #FFFFFF;

    --whendl-surface: #383838;
    --whendl-header-glyph: #C7C7C7;
    --whendl-header-glyph-hover: #FFFFFF;
}

body {
    min-height: 100vh;
}

/* ============================================================
   Header / nav bar — constant brand mauve regardless of theme,
   same as the WPF app's header, which never inverts
   ============================================================ */
.whendl-header {
    background: var(--whendl-brand);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.whendl-header .whendl-wordmark {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.whendl-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.whendl-wordmark-svg {
    height: 25px;
    width: auto; /* preserves the SVG's own 139:30 aspect ratio */
}

.whendl-header nav a {
    color: #E8D9E2;
    text-decoration: none;
    margin-right: 1.25rem;
    font-size: 0.95rem;
}

.whendl-header nav a:hover,
.whendl-header nav a.active {
    color: #FFFFFF;
}

.whendl-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.whendl-header-actions form {
    margin: 0;
}

.whendl-header-actions button.link-button {
    background: none;
    border: none;
    color: #E8D9E2;
    cursor: pointer;
    font: inherit;
    font-size: 0.95rem;
    padding: 0;
}

.whendl-header-actions button.link-button:hover {
    color: #FFFFFF;
}

.whendl-header-account {
    color: #E8D9E2;
    font-size: 0.95rem;
}

/* ── Circular icon button — same visual language as the WPF header
   button circles: constant dark accent background, glyph-only hover ── */
.whendl-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--whendl-brand-accent);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #C7C7C7;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.whendl-icon-btn:hover {
    color: #FFFFFF;
}

.whendl-icon-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Theme toggle shows one icon depending on the active theme */
[data-bs-theme="light"] .whendl-icon-theme-toggle .icon-moon { display: none; }
[data-bs-theme="dark"]  .whendl-icon-theme-toggle .icon-sun  { display: none; }

/* ============================================================
   Page shell — centered narrow column for auth-style pages,
   matching the reference site's minimal centered layout
   ============================================================ */
.whendl-centered-page {
    max-width: 440px;
    margin: 4.5rem auto;
    padding: 0 1rem;
}

.whendl-centered-page h1 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.whendl-centered-page .lead {
    color: var(--bs-secondary-color);
    margin-bottom: 2rem;
}

/* ── Inputs — subtle bordered field, no heavy card behind it,
   matching the reference site's flat/minimal form styling ── */
.whendl-centered-page .form-control {
    background: transparent;
    border-color: var(--bs-border-color);
    padding: 0.65rem 0.9rem;
}

.whendl-centered-page .form-control:focus {
    border-color: var(--whendl-brand);
    box-shadow: 0 0 0 0.2rem rgba(140, 85, 117, 0.25);
    background: transparent;
}

/* ── Pill-style primary button, matching the app's Start Tracking button ── */
.btn-whendl-primary {
    background: var(--whendl-brand);
    border: none;
    color: #FFFFFF;
    border-radius: 999px;
    padding: 0.65rem 1.75rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.btn-whendl-primary:hover {
    background: var(--whendl-brand-accent);
    color: #FFFFFF;
}

.btn-whendl-primary:disabled {
    opacity: 0.5;
}

main {
    padding-bottom: 3rem;
}

/* ============================================================
   Help page — readable article layout, works inside both
   _Layout (normal browser visit) and _EmbeddedLayout (WebView2 etc)
   ============================================================ */
.whendl-help-page {
    max-width: 720px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.whendl-help-page h1 {
    font-weight: 700;
}

.whendl-help-page section {
    margin-bottom: 2.5rem;
}

.whendl-help-page h2 {
    font-weight: 700;
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.4rem;
    margin-bottom: 1rem;
}

.whendl-help-page pre {
    background: var(--bs-tertiary-bg);
    border-radius: 0.4rem;
    padding: 0.75rem 1rem;
}

.whendl-help-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.95rem;
}

.whendl-help-toc a {
    color: var(--whendl-brand);
    text-decoration: none;
}

.whendl-help-toc a:hover {
    text-decoration: underline;
}

.whendl-help-status-list {
    list-style: none;
    padding-left: 0;
}

.whendl-help-status-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.whendl-help-status-text {
    flex: 1;
}

.whendl-help-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 4px;
}

.whendl-help-swatch-pending  { background: var(--whendl-status-pending); }
.whendl-help-swatch-running  { background: var(--whendl-status-running); }
.whendl-help-swatch-paused   { background: var(--whendl-status-paused); }
.whendl-help-swatch-archived { background: var(--whendl-status-stopped); }

/* ============================================================
   Embedded layout (_EmbeddedLayout.cshtml) — no header/footer,
   just enough padding that content isn't flush against a
   WebView2 window's own edges
   ============================================================ */
.whendl-embedded-body {
    min-height: 100vh;
}

.whendl-embedded-page {
    padding: 0.5rem 0;
}

.whendl-footer {
    min-height: 3rem; /* holds space so the page doesn't look abruptly cut off, even while empty */
}

/* ============================================================
   Account Overview — sidebar shell
   ============================================================ */
.whendl-overview-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1100px;
    margin: 2rem auto 1.5rem;
    padding: 0 1.5rem;
}

.whendl-overview-header .whendl-icon {
    width: 40px;
    height: 40px;
}

.whendl-overview-header h1 {
    font-weight: 700;
    margin: 0;
}

.whendl-overview-shell {
    display: flex;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    align-items: flex-start;
}

.whendl-sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--bs-border-color);
    padding-right: 1.5rem;
}

.whendl-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.6rem;
    margin: 0 -0.6rem;
    border-radius: 0.4rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.95rem;
    border: none;
    background: none;
    text-align: left;
    width: calc(100% + 1.2rem);
}

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

.whendl-sidebar-link:hover:not(.disabled) {
    color: var(--bs-body-color);
}

.whendl-sidebar-link.active {
    color: var(--bs-body-color);
    font-weight: 600;
    background: var(--whendl-surface);
}

.whendl-sidebar-link.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.whendl-sidebar-button {
    cursor: pointer;
}

.whendl-sidebar-signout-form {
    margin: 0;
}

.whendl-content-placeholder {
    flex: 1;
    min-height: 480px;
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    font-size: 1.75rem;
    text-align: center;
    padding: 2rem;
}

/* For sidebar pages with real content (as opposed to .whendl-content-placeholder,
   which is still useful for sidebar items that don't have a built page yet) */
.whendl-content-area {
    flex: 1;
    min-width: 0; /* prevents table content from forcing the flex item wider than the column */
}

/* ============================================================
   Reports list page — one block per report type
   ============================================================ */
.whendl-report-entry {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

.whendl-report-form {
    max-width: 380px;
}

/* ============================================================
   Report pages (_ReportLayout.cshtml) — always light, "printout"
   look regardless of the site's theme setting
   ============================================================ */
.whendl-report-body {
    background: #E4E4E4;
    color: #1A1A1A;
    min-height: 100vh;
}

.whendl-report-page {
    max-width: 900px;
    margin: 3rem auto 4rem;
    padding: 0 1.5rem;
}

.whendl-report-paper {
    background: #FFFFFF;
    border-radius: 0.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    padding: 3rem 3.5rem;
    position: relative;
}

.whendl-report-paper h1 {
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
}

.whendl-report-paper .whendl-report-subtitle {
    text-align: center;
    font-style: italic;
    color: #555555;
    margin-bottom: 2rem;
}

.whendl-report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2.5rem;
}

.whendl-report-table th {
    text-align: left;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: #3A5A9C;
    border-bottom: 2px solid #DDDDDD;
    padding: 0.5rem 0.75rem;
}

.whendl-report-table th:not(:first-child),
.whendl-report-table td:not(:first-child) {
    text-align: right;
}

.whendl-report-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #EEEEEE;
    color: #333333;
}

.whendl-report-table td:first-child {
    color: #777777;
    letter-spacing: 0.02em;
}

.whendl-report-caption {
    position: absolute;
    bottom: 1.5rem;
    right: 3rem;
    font-size: 0.8rem;
    color: #999999;
}

.whendl-report-chart-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.whendl-report-chart-canvas-wrap {
    width: 260px;
    height: 260px;
    flex-shrink: 0;
}

.whendl-report-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.whendl-report-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: #333333;
}

.whendl-report-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
