/*
 * EnTree Dashboard - Custom Styles
 * Figma-aligned color palette and component overrides
 */

/* ===========================
   CSS Custom Properties
   =========================== */
:root {
    /* Primary Colors - Olive Green Theme */
    --entree-olive: #556B2F;
    --entree-olive-hover: #6B8E23;
    --entree-olive-light: #F0F4E8;

    /* Background Colors */
    --entree-cream: #F5F1E8;
    --entree-blue: #D4E8F5;

    /* Neutral Colors */
    --entree-gray: #E8E8E8;
    --entree-text: #3D3D3D;
    --entree-text-muted: #8C8C8C;

    /* Layout (quick 261001-fkx: shared by .sidebar-nav width and
       main.main-content's margin-left so they can never drift apart) */
    --entree-sidebar-width: 112px;

    /* Draft/placeholder pair (Phase 24) -- same colors already used inline for
       the environment-label banner (templates/admin/base_site.html,
       authentication/login.html); promoted to named tokens here so the
       "Entwurf" notice and the [BITTE ERGÄNZEN: ...] highlight share exactly
       one "not finished yet" visual language with the rest of the app. */
    --entree-draft-bg: #F8EFE0;
    --entree-draft-text: #7C5E28;
}

/* ===========================
   Global Overrides
   =========================== */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Main content offset for sidebar */
@media (min-width: 992px) {
    main.main-content {
        margin-left: var(--entree-sidebar-width);
    }
}

/* ===========================
   Sidebar Navigation
   =========================== */
.sidebar-nav {
    background-color: #fff;
    border-right: 1px solid var(--entree-gray);
}

@media (min-width: 992px) {
    .sidebar-nav {
        width: var(--entree-sidebar-width);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1030;
    }
}

/* Sidebar Logo */
.sidebar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* Sidebar Nav Links */
.sidebar-nav .nav-link {
    color: var(--entree-text-muted);
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    /* Safety net for the longer "Zur Administration" label (lang="de", so the
       browser hyphenates instead of letting it spill past the sidebar). */
    hyphens: auto;
    overflow-wrap: break-word;
}

.sidebar-nav .nav-link:hover {
    background-color: #f0f0f0;
    color: var(--entree-olive);
}

.sidebar-nav .nav-link.active {
    color: var(--entree-olive);
    background-color: var(--entree-olive-light);
    font-weight: 600;
}

/* Logout button as nav link */
.sidebar-nav form {
    /* Bootstrap's w-100 on the button below fills this padded box instead of
       the raw sidebar width, so it no longer pokes past the right border. */
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.sidebar-nav form button.nav-link {
    border: none;
    background: transparent;
    cursor: pointer;
    margin-left: 0;
    margin-right: 0;
}

/* ===========================
   Header link contrast (all widths)
   navbar-dark's rgba(255,255,255,.55) is only ~3:1 on #556B2F; .9 alpha is ~5:1
   and meets WCAG AA for the Konto link.
   =========================== */
.entree-navbar {
    --bs-navbar-color: rgba(255, 255, 255, 0.9);
    --bs-navbar-hover-color: #fff;
    --bs-navbar-active-color: #fff;
}

/* ===========================
   Header (mobile)
   Below lg the navbar collapse is the only menu control (the sidebar offcanvas
   has no toggle there), so the toggler gets a brighter border and icon.
   =========================== */
@media (max-width: 991.98px) {
    .entree-navbar {
        --bs-navbar-toggler-border-color: rgba(255, 255, 255, 0.6);
        --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23fff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    }

    .entree-navbar .navbar-collapse .navbar-text {
        display: block;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.25);
        margin-top: 0.25rem;
    }

    .entree-navbar .navbar-collapse form {
        display: block !important;
        margin: 0.5rem 0 0.75rem;
    }
}

/* ===========================
   Button Overrides
   =========================== */
.btn-primary {
    background-color: var(--entree-olive);
    border-color: var(--entree-olive);
}

.btn-primary:hover {
    background-color: var(--entree-olive-hover);
    border-color: var(--entree-olive-hover);
}

.btn-primary:focus,
.btn-primary:active {
    background-color: var(--entree-olive-hover);
    border-color: var(--entree-olive-hover);
    box-shadow: 0 0 0 0.25rem rgba(85, 107, 47, 0.25);
}

.btn-outline-primary {
    color: var(--entree-olive);
    border-color: var(--entree-olive);
}

.btn-outline-primary:hover {
    background-color: var(--entree-olive);
    border-color: var(--entree-olive);
    color: #fff;
}

.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--entree-olive);
    border-color: var(--entree-olive);
    color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(85, 107, 47, 0.25);
}

/* ===========================
   Activation Code (Phase 22, D-14/D-16)
   Sizes are set inline per use (20px on the detail page, 28px on the
   confirmation page in plan 22-04) so no 5th font size is introduced.
   =========================== */
.activation-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--entree-text);
}

/* ===========================
   Table Styling
   =========================== */
.patient-table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid var(--entree-gray);
}

.patient-table tbody tr {
    border-bottom: 1px solid var(--entree-gray);
}

.patient-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* ===========================
   Nav Tabs
   =========================== */
.nav-tabs .nav-link {
    color: var(--entree-text-muted);
}

.nav-tabs .nav-link:hover {
    color: var(--entree-olive);
}

.nav-tabs .nav-link.active {
    color: var(--entree-olive);
    border-bottom-color: var(--entree-olive);
    border-bottom-width: 3px;
    font-weight: 600;
}

/* ===========================
   Public content pages (Phase 24)
   =========================== */
.content-page {
    background: var(--entree-cream);
    color: var(--entree-text);
}

.content-column {
    max-width: 720px;
}

.content-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}

.content-dateline {
    color: var(--entree-text-muted);
}

.content-draft-notice {
    background: var(--entree-draft-bg);
    color: var(--entree-draft-text);
    border-radius: .375rem;
    font-size: 14px;
}

/* Collapsed-state FAQ draft marker (WR-03): visible on the accordion button so
   an unfinished entry is flagged before it is expanded. Same draft pair. */
.content-draft-badge {
    background: var(--entree-draft-bg);
    color: var(--entree-draft-text);
    font-weight: 600;
}

.content-body {
    font-size: 16px;
    line-height: 1.5;
}

/* h5/h6: Hilfe page demotes Markdown ##/### so they nest under the section
   <h4> (WCAG 1.3.1); they must look identical to h2/h3 on the legal pages. */
.content-body h2,
.content-body h5 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 1.5rem;
}

.content-body h3,
.content-body h6 {
    font-size: 16px;
    font-weight: 600;
}

.content-body a {
    color: var(--entree-olive);
}

mark.content-placeholder {
    background: var(--entree-draft-bg);
    color: var(--entree-draft-text);
    padding: 0 .2em;
}

/* ===========================
   Hilfe page (Phase 25)
   =========================== */
.hilfe-jump-list a {
    color: var(--entree-olive);
}

.accordion-button:not(.collapsed) {
    color: var(--entree-olive);
    background-color: var(--entree-olive-light);
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(85, 107, 47, 0.25);
}

/* ===========================
   Session warning (Phase 27)
   =========================== */
.session-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--entree-draft-bg);
    color: var(--entree-draft-text);
    font-size: 18px;
}
