/* App-wide color palette. Bootstrap 5.3's components read their colors
   from these CSS custom properties, so overriding them here recolors
   buttons/badges/links/etc. everywhere without needing a Sass build. */

:root {
    --bs-primary: #1d7a74;
    --bs-primary-rgb: 29, 122, 116;
    --bs-primary-text-emphasis: #124a46;
    --bs-primary-bg-subtle: #d9efed;
    --bs-primary-border-subtle: #a9d9d4;

    --bs-success: #3f9d52;
    --bs-success-rgb: 63, 157, 82;

    --bs-warning: #e8a13d;
    --bs-warning-rgb: 232, 161, 61;

    --bs-danger: #d9534f;
    --bs-danger-rgb: 217, 83, 79;

    --bs-info: #3b82c4;
    --bs-info-rgb: 59, 130, 196;

    --bs-link-color: var(--bs-primary);
    --bs-link-hover-color: var(--bs-primary-text-emphasis);

    /* House Rules get their own distinct accent (violet) so a linked rule
       badge stands out from ordinary status/type badges wherever it
       appears - task pages, templates, penalties, the rules list itself. */
    --app-rules-accent: #7c4dff;
    --app-rules-accent-bg: #efe9ff;
    --app-rules-accent-text: #4a2fb0;

    /* System-wide currency colors: anything tied to Kudos Coins reads
       gold/amber (game-coin association), anything tied to Kudos XP
       reads green (the common game convention) - deliberately a
       different green from --bs-success below, so "you earned XP" never
       visually reads as the same signal as "this was approved". Overdue
       items and penalties always use --bs-danger (red) - see badge/card
       usage throughout the views, not a separate variable here. */
    --app-coins-accent: #c68e17;
    --app-coins-accent-bg: #fbf0d9;
    --app-coins-accent-text: #7a5510;
    --app-xp-accent: #6a9c34;
    --app-xp-accent-bg: #eef5e0;
    --app-xp-accent-text: #3f5c1f;

    --app-navbar-bg: #163e3a;
    --app-superadmin-navbar-bg: #16232e;
    --app-bg: #f6f8f7;

    /* Task/assignment status colors - one color per stage, used
       consistently everywhere a status appears (task list, task detail,
       house rule history, dashboard) so the same status never looks
       different depending on which page you're looking at it from. */
    --app-status-available: #7DD3FC;
    --app-status-claimed: #A5B4FC;
    --app-status-in_progress: #FDE047;
    --app-status-submitted: #C0EB75;
    --app-status-approved: #49F587;
    --app-status-rejected: #FCA5A5;
    --app-status-overdue: #F87171;
    --app-status-expired: #CD5C5C;
    --app-status-disabled: #9CA3AF;
}

body {
    background-color: var(--app-bg);
}

.navbar.app-navbar {
    background-color: var(--app-navbar-bg) !important;
}

.navbar.app-superadmin-navbar {
    background-color: var(--app-superadmin-navbar-bg) !important;
}

.card {
    border: 1px solid rgba(0, 0, 0, .08);
}

.card.border-accent { border-top: 3px solid var(--bs-primary); }
.card.border-accent-warning { border-top: 3px solid var(--bs-warning); }
.card.border-accent-success { border-top: 3px solid var(--bs-success); }
.card.border-accent-info { border-top: 3px solid var(--bs-info); }
.card.border-accent-rules { border-top: 3px solid var(--app-rules-accent); }
.card.border-accent-coins { border-top: 3px solid var(--app-coins-accent); }
.card.border-accent-xp { border-top: 3px solid var(--app-xp-accent); }

/* Soft colored backgrounds for dashboard summary cards, rotating through
   the palette so the dashboard isn't a wall of identical white boxes. */
.card.tint-primary { background-color: var(--bs-primary-bg-subtle); }
.card.tint-warning { background-color: #fbf1de; }
.card.tint-success { background-color: #e4f4e7; }
.card.tint-info     { background-color: #e3edf7; }
.card.tint-rules    { background-color: var(--app-rules-accent-bg); }
.card.tint-coins    { background-color: var(--app-coins-accent-bg); }
.card.tint-xp       { background-color: var(--app-xp-accent-bg); }

/* A linked House Rule badge - used everywhere a rule is referenced
   (tasks, templates, penalties, the rules list) so it reads as its own
   distinct "type" of thing at a glance, not just another grey label. */
.badge-rules {
    background-color: var(--app-rules-accent);
    color: #fff;
}
a.badge-rules:hover {
    background-color: var(--app-rules-accent-text);
    color: #fff;
}

/* Kudos Coins and Kudos XP badges - used system-wide anywhere either
   currency is shown, so the two are visually distinct at a glance
   (gold = coins, green = XP) instead of both being generic grey/white
   badges that only differ by their text label.
   Includes full badge sizing (not just color) since these replace
   Bootstrap's own .badge class rather than layering on top of it. */
.badge-coins,
.badge-xp,
.badge-coins-solid,
.badge-xp-solid {
    display: inline-block;
    padding: .4em .65em;
    font-size: .75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .5rem;
}
.badge-coins {
    background-color: var(--app-coins-accent-bg);
    color: var(--app-coins-accent-text);
    border: 1px solid var(--app-coins-accent);
}
.badge-xp {
    background-color: var(--app-xp-accent-bg);
    color: var(--app-xp-accent-text);
    border: 1px solid var(--app-xp-accent);
}
/* Solid variants for contexts that want more visual weight (e.g. a
   reward highlighted on an "available job" card). */
.badge-coins-solid {
    background-color: var(--app-coins-accent);
    color: #fff;
}
.badge-xp-solid {
    background-color: var(--app-xp-accent);
    color: #fff;
}

/* Task/assignment status badges - see --app-status-* variables above.
   Includes full badge sizing (matches .badge-coins/.badge-xp) since these
   are meant to be used standalone, not layered on Bootstrap's .badge. */
.badge-status {
    display: inline-block;
    padding: .4em .65em;
    font-size: .75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .5rem;
    color: #1f2937;
}
.badge-status-available    { background-color: var(--app-status-available); }
.badge-status-claimed      { background-color: var(--app-status-claimed); }
.badge-status-in_progress  { background-color: var(--app-status-in_progress); }
.badge-status-submitted    { background-color: var(--app-status-submitted); }
.badge-status-approved     { background-color: var(--app-status-approved); }
.badge-status-rejected     { background-color: var(--app-status-rejected); }
.badge-status-overdue      { background-color: var(--app-status-overdue); color: #fff; }
.badge-status-expired      { background-color: var(--app-status-expired); color: #fff; }
.badge-status-disabled     { background-color: var(--app-status-disabled); color: #fff; }

/* Dashboard summary cards that link somewhere - keeps the plain card look
   but signals it's clickable and gives a little lift on hover. */
a.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform .1s ease, box-shadow .1s ease;
}
a.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
}
a.card-link:hover .card {
    border-color: var(--bs-primary-border-subtle);
}

.nav-tabs .nav-link.active {
    border-bottom: 2px solid var(--bs-primary);
    font-weight: 600;
}

/* Preserves line breaks the user actually typed (descriptions etc.)
   while still going through htmlspecialchars() for safety - see
   View::multiline(). */
.preserve-lines {
    white-space: pre-line;
}

/* Lightweight help-icon tooltip trigger - see View::helpIcon(). */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    margin-left: 4px;
    text-decoration: none;
}

/* Markdown-rendered text (descriptions, instructions, notes) - see
   View::markdown(). Keeps spacing tight so it fits naturally inside
   cards, table cells, and list items rather than adding browser-default
   paragraph/list margins everywhere. */
.markdown-content > *:first-child { margin-top: 0; }
.markdown-content > *:last-child { margin-bottom: 0; }
.markdown-content p { margin-bottom: .5rem; }
.markdown-content ul, .markdown-content ol { margin-bottom: .5rem; padding-left: 1.25rem; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 { font-size: 1rem; font-weight: 700; margin: .5rem 0 .25rem; }
.markdown-content code {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    padding: .1em .3em;
    border-radius: 3px;
    font-size: .9em;
}

/* Task detail page header: title/description/house-rules layout.
   Mobile: normal stacked flex-column (order-1/2/3 utility classes on the
   elements themselves control the sequence). Large screens: switches to
   a named-area grid so the rules column spans both the title and
   description rows and sits right-aligned, level with the H1, rather
   than pushed below everything. */
@media (min-width: 992px) {
    .task-header-grid .th-rules {
        float: right;
        width: 320px;
        margin-top: 0.5rem;
        margin-left: 1.5rem;
        margin-bottom: 1rem;
    }
}
/* Routine Templates list - collapsible per-routine group (templates/index.phtml) */
.routine-tpl-group > summary {
    position: relative;
    cursor: pointer;
    padding-right: 2.5rem;
    background-color: var(--bs-primary-bg-subtle, #dceceb);
    border: 1px solid var(--bs-border-color, #dee2e6);
    user-select: none;
}
.routine-tpl-group > summary:hover {
    background-color: var(--bs-secondary-bg, #e9ecef);
}
.routine-tpl-group > summary .expand-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--bs-secondary-color, #6c757d);
}
.routine-tpl-group > summary .expand-toggle::before {
    content: "+";
}
.routine-tpl-group[open] > summary .expand-toggle::before {
    content: "\2212";
}

/* Password strength meter - see public/assets/js/password-strength.js */
.password-strength-bar-wrap {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}
.password-strength-bar {
    height: 100%;
    width: 0;
    transition: width .2s ease, background-color .2s ease;
}
.password-strength-reqs .req-icon {
    display: inline-block;
    width: 1.1em;
}
