/**
 * cards.css — Tokenized Card Components
 * ============================================================
 * Overrides module.css hardcoded values with design tokens.
 * Shared across all module pages.
 * Depends on: 1-tokens.css (must load before this)
 * ============================================================
 */

/* --------------------------------------------------------
 * BASE CARD (.card, .card-header, .card-body, .card-footer)
 * -------------------------------------------------------- */
.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
}

.card-header {
    background: var(--color-surface);
    border-bottom: var(--border-width) solid var(--border-color-light);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-header h5 {
    margin: 0;
    font-size: var(--text-md);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
}

/* A colored header (bg-primary text-white, bg-warning text-dark...) gives its
   heading the header's own text color: the rule above painted the title in the
   text color on the colored band, brown on brown. */
.card-header:is(.text-white, .text-dark, .text-light, [class*="text-bg-"]) :is(h5, h6) { color: inherit; }

.card-body {
    padding: var(--space-5) var(--space-6);
}
.card:not([class*="bg-"]) > .card-body {
    background: var(--color-surface);
    /* Follow the card's shape. This background is painted on top of the card,
       so with square corners it covered a rounded card's corners and every
       card rendered square no matter what radius it was given. */
    border-radius: inherit;
}

/* --------------------------------------------------------
 * FORM CARD (.form-card, .form-card-header, .form-card-body)
 * -------------------------------------------------------- */
.form-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
}

.form-card-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: var(--border-width) solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.form-card-header h6 {
    margin: 0;
    font-weight: var(--font-semibold);
    color: var(--color-gray-900);
    font-size: var(--text-base);
}

.form-card-header i {
    color: var(--color-secondary);
    font-size: var(--text-lg);
}

.form-card-body {
    padding: var(--space-5) var(--space-6);
}

/* --------------------------------------------------------
 * DASH CARD — dashboard panels
 * -------------------------------------------------------- */
.dash-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    border: none;
    overflow: hidden;
}

.dash-card-header {
    padding: var(--space-5) var(--space-7);
    border-bottom: var(--border-width) solid var(--border-color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-card-header h6 {
    margin: 0;
    font-size: var(--text-md);
    font-weight: var(--font-bold);
    color: var(--color-gray-900);
}

.dash-card-body {
    padding: 0;
}

.dash-card-body.padded {
    padding: var(--space-7);
}

/* --------------------------------------------------------
 * PAGE / CONTENT HEADER — used on nearly every page
 * -------------------------------------------------------- */
.page-header {
    margin-bottom: var(--space-5);
}

.page-header h2 {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.page-header p,
.page-header-sub {
    color: var(--color-text-secondary);
    margin: 0;
    font-size: var(--text-sm);
}
.page-header-sub { margin-top: 4px; }

/* One button size in the header row: Back is a regular .btn, so actions a page
   wrote as .btn-sm come up to match instead of sitting shorter beside it. */
.page-header .btn-sm {
    font-size: var(--text-base);
    padding: var(--space-2) var(--space-5);
}

/* A picker among the header's buttons (the school year) sits in the row at its
   own width: .form-select is full width, which wrapped it onto a line of its
   own and the buttons around it onto lines of their own too. */
.page-header-actions .form-select,
.page-header-actions .form-control { width: auto; }

/* Beside the title: a badge ("3 pending", "View only", the department) and a
   muted remark ("(Grade School)") -- page_header()'s 'badge' / 'note'. */
.page-header h2 .page-header-badge {
    margin-left: var(--space-3);
    font-size: var(--text-sm);
    vertical-align: middle;
    position: relative;
    top: -2px;
}
.page-header h2 .page-header-note {
    margin-left: var(--space-2);
    font-size: var(--text-md);
    font-weight: var(--font-normal, 400);
    color: var(--color-text-muted);
}

.content-header {
    margin-bottom: var(--space-7);
}

.content-header h4 {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-gray-900);
    margin: 0;
}

.content-header p {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    margin: 2px 0 0;
}

/* --------------------------------------------------------
 * MODULE CARD (.module-card) — clickable nav cards
 * -------------------------------------------------------- */
.module-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.module-card h5 {
    font-size: var(--text-md);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.module-card p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
    flex: 1;
}

/* Accent variant — pair .is-accent with an .accent-* class. The .accent-*
   class sets --accent from a palette token; .is-accent draws the left border
   from it, and a child .btn-accent (buttons.css) picks up the same hue, so a
   card's button always matches its section color. */
.module-card.is-accent {
    border-left: 4px solid var(--accent, var(--color-primary));
}

/* Accent palette helpers — set --accent from a named token (tokens.css).
   Usable on any element; intended for .module-card.is-accent / .btn-accent. */
.accent-green  { --accent: var(--accent-green); --accent-strong: var(--accent-green-strong); }
.accent-blue   { --accent: var(--accent-blue); --accent-strong: var(--accent-blue); }
.accent-purple { --accent: var(--accent-purple); --accent-strong: var(--accent-purple); }
.accent-amber  { --accent: var(--accent-amber); --accent-strong: var(--accent-amber-strong); }
.accent-red    { --accent: var(--accent-red); --accent-strong: var(--accent-red-strong); }
.accent-cyan   { --accent: var(--accent-cyan); --accent-strong: var(--accent-cyan-strong); }
.accent-indigo { --accent: var(--accent-indigo); --accent-strong: var(--accent-indigo-strong); }
.accent-pink   { --accent: var(--accent-pink); --accent-strong: var(--accent-pink); }
.accent-teal   { --accent: var(--accent-teal); --accent-strong: var(--accent-teal-strong); }
.accent-orange { --accent: var(--accent-orange); --accent-strong: var(--accent-orange-strong); }
.accent-slate  { --accent: var(--accent-slate); --accent-strong: var(--accent-slate); }

/* --------------------------------------------------------
 * SECTION CARD (.section-card) — colored indicator cards
 * -------------------------------------------------------- */
.section-card {
    background: var(--color-success-bg);
    border: var(--border-width) solid var(--tone-green-border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

/* --------------------------------------------------------
 * SECTION HEADER — inside form sections
 * -------------------------------------------------------- */
.section-header {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: var(--border-width) solid var(--border-color-light);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.section-header i {
    color: var(--color-secondary);
    font-size: var(--text-2xl);
}

.subsection-label {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--brand-ink);
    margin-top: var(--space-5);
    margin-bottom: var(--space-4);
    padding-left: var(--space-3);
    border-left: 3px solid var(--color-secondary);
}

/* --------------------------------------------------------
 * FORM SECTION — white card wrapping a form group
 * -------------------------------------------------------- */
.form-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.form-section .form-control,
.form-section .form-select {
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    transition: var(--transition-base);
}

.form-section .form-control:focus,
.form-section .form-select:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.form-section .form-label {
    font-weight: var(--font-semibold);
    color: var(--color-gray-700);
    margin-bottom: 4px;
    font-size: var(--text-sm);
}

/* --------------------------------------------------------
 * INFO ROWS — label/value pairs inside cards
 * -------------------------------------------------------- */
.info-row {
    display: flex;
    padding: var(--space-3) 0;
    border-bottom: var(--border-width) solid var(--border-color-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    width: 140px;
    min-width: 140px;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
}

.info-value {
    flex: 1;
    font-weight: var(--font-medium);
    font-size: var(--text-base);
    color: var(--color-gray-900);
}

/* --------------------------------------------------------
 * HOVER & TRANSITION STATES
 * -------------------------------------------------------- */
.stat-card {
    transition: var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------
 * FILTER BAR (.filter-bar; .filter-card is the same thing)
 * The strip of filters above a list: a card's surface, radius
 * and shadow, so it reads as part of the page in both themes.
 * -------------------------------------------------------- */
.filter-bar,
.filter-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-7) var(--space-8);
    margin-bottom: var(--space-7);
}

/* --------------------------------------------------------
 * PHONES
 * -------------------------------------------------------- */
@media (max-width: 575.98px) {
    /* A card header that is a toolbar (a title, then pickers or buttons):
       each group stays inside the header, so a picker in it narrows to fit
       (forms.css) instead of pushing the header past the screen edge. */
    .card-header.d-flex > * { min-width: 0; max-width: 100%; }
}
