/* ==========================================================================
   contrast-aa.css  —  WCAG 2.2 AA contrast corrections
   --------------------------------------------------------------------------
   Loaded LAST in templates/partials/base.html (after app.min.css), so these
   rules win over both the theme stylesheet and each page's {% block extra_css %}
   (which renders earlier in <head>).

   Loaded with ?v=20261018 — assets/ is served with max-age=604800, so without
   a cache-buster browsers keep the old CSS for 7 days.

   Measured with a real WCAG 2.x luminance audit against the rendered DOM
   (gradient stops included, not just background-color). Every value below was
   computed, not eyeballed: all text pairs clear 4.6:1 (AA needs 4.5:1 for
   text under 18.66px, 3:1 for large text).

   To revert: delete this file and remove the <link> from base.html.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Semantic text colours on light surfaces
      Originals were: muted #74788d (4.36), warning #eeb148 (1.91),
      info #5ba4e5 (2.66), success #23c58f (2.22), danger #f14e4e (3.54).
   -------------------------------------------------------------------------- */
.text-muted   { color: #707489 !important; }   /* 4.60:1 on #fff */
.text-warning { color: #9f6a0f !important; }   /* 4.60:1 on #fff */
.text-info    { color: #1f78c7 !important; }   /* 4.60:1 on #fff */
.text-success { color: #188561 !important; }   /* 4.60:1 on #fff */
.text-danger  { color: #e91212 !important; }   /* 4.60:1 on #fff */

/* --------------------------------------------------------------------------
   2. Semantic backgrounds carrying white text
      Card headers (.card-header.bg-*) and .badge use white text, so the
      background has to be dark enough for white to pass.
   -------------------------------------------------------------------------- */
.bg-danger  { background-color: #e91212 !important; }   /* white = 4.60:1 */
.bg-success { background-color: #188561 !important; }   /* white = 4.60:1 */
.bg-warning { background-color: #9f6a0f !important; }   /* white = 4.60:1 */
.bg-info    { background-color: #1f78c7 !important; }   /* white = 4.60:1 */

/* --------------------------------------------------------------------------
   3. Stat cards + financial summary
      .stat-card already declared color:white, but app.min.css sets a bare
      `h4 { color:#495057 }`, which won on specificity — that is why the big
      numbers rendered dark grey on the gradient (1.68:1).

      The gradients are also deepened: the original light stops (#38ef7d,
      #f093fb, #667eea…) simply cannot carry white text at 4.5:1. Hue and
      gradient direction are preserved; only lightness is reduced.

      Hierarchy is now carried by font-size/weight rather than opacity — the
      .opacity-50/.opacity-75 utilities are neutralised so no label is dimmed
      below the contrast floor.
   -------------------------------------------------------------------------- */
.stat-card,
.financial-summary {
    background-image: linear-gradient(135deg, #1d3dd0 0%, #764ba2 100%) !important;
    color: #fff !important;
}
.stat-card.reserved  { background-image: linear-gradient(135deg, #0f837a 0%, #0b873a 100%) !important; }
.stat-card.cancelled { background-image: linear-gradient(135deg, #ea0035 0%, #e52300 100%) !important; }
.stat-card.pending   { background-image: linear-gradient(135deg, #c808df 0%, #e90e2b 100%) !important; }

/* Force every text node inside these cards to pure white, whatever the theme
   or a utility class says. */
.stat-card h1, .stat-card h2, .stat-card h3, .stat-card h4,
.stat-card h5, .stat-card h6, .stat-card p, .stat-card small,
.stat-card span, .stat-card div, .stat-card i, .stat-card strong,
.stat-card .text-muted, .stat-card .text-dark, .stat-card .text-light,
.financial-summary h1, .financial-summary h2, .financial-summary h3,
.financial-summary h4, .financial-summary h5, .financial-summary h6,
.financial-summary p, .financial-summary small, .financial-summary span,
.financial-summary div, .financial-summary i, .financial-summary strong,
.financial-summary .text-muted, .financial-summary .text-dark {
    color: #fff !important;
}

/* No dimming inside the cards. */
.stat-card .opacity-25, .stat-card .opacity-50, .stat-card .opacity-75,
.financial-summary .opacity-25, .financial-summary .opacity-50,
.financial-summary .opacity-75 {
    opacity: 1 !important;
}

/* --------------------------------------------------------------------------
   4. Filter buttons
      Same specificity trap as the cards: app.min.css `.btn` overrode the
      white declared alongside the gradient, giving dark-on-purple (1.68:1).
   -------------------------------------------------------------------------- */
.btn-filter {
    background-image: linear-gradient(45deg, #1d3dd0, #764ba2) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
}
.btn-filter:hover,
.btn-filter:focus,
.btn-filter:active {
    color: #fff !important;
    background-image: linear-gradient(45deg, #1a37bd, #6b4394) !important;
}

/* --------------------------------------------------------------------------
   5. Page title block (#525ce5)
      #495057 on #525ce5 was 1.57:1. White gives 5.22:1; the subtitle keeps a
      soft tint at 4.73:1. The .text-primary icon was #525ce5 on #525ce5 —
      effectively invisible.
   -------------------------------------------------------------------------- */
.page-title-box .page-title h3,
.page-title-box .page-title h3 i,
.page-title-box .page-title h3 .text-primary {
    color: #fff !important;
}
.page-title-box .page-title p,
.page-title-box .page-title p.text-dark {
    color: #f2f3ff !important;
}

/* --------------------------------------------------------------------------
   6. ApexCharts
      The library injects #74788d (4.36:1) as an inline SVG fill for legends
      and axis ticks. !important in a stylesheet beats an inline declaration.
   -------------------------------------------------------------------------- */
.apexcharts-legend-text,
.apexcharts-text,
.apexcharts-xaxis text,
.apexcharts-yaxis text,
.apexcharts-xaxis-title-text,
.apexcharts-yaxis-title-text {
    fill: #707489 !important;
}
.apexcharts-legend-marker {
    stroke: #707489 !important;
}

/* --------------------------------------------------------------------------
   7. Visible keyboard focus
      The gradients swallowed the default focus ring.
   -------------------------------------------------------------------------- */
.btn-filter:focus-visible,
.stat-card a:focus-visible,
.btn:focus-visible {
    outline: 3px solid #fff !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px #1d3dd0 !important;
}
/* --------------------------------------------------------------------------
   8. Remaining inherited greys (found by re-audit, 4.36:1 -> 4.60:1)

   - footer.footer declares #74788d, inherited by "Crafted with ... by createdz".
   - ApexCharts writes legend colours inline per series, so !important is
     required to beat both the inline declaration and the inherited colour.
   -------------------------------------------------------------------------- */
footer.footer,
.footer .text-sm-end {
    color: #707489 !important;
}

.apexcharts-legend-text {
    color: #707489 !important;
    fill: #707489 !important;
}

/* --------------------------------------------------------------------------
   9. Third-party components (pre-existing failures, found by re-audit)

   a) DataTables export buttons: #edf1f5 text on #74788d = 3.84:1
   b) Pagination .page-link: #ced4da on white = 1.49:1 (Previous / Next)
   c) .btn-success/.btn-danger/.btn-warning/.btn-info: white on light fills
   d) .badge-soft-*: saturated text on its own pale tint
   e) .breadcrumb-item.active: #eaedf1 on #525ce5 = 4.45:1 (just under)
   f) FullCalendar dims .fc-other-month to opacity .3 and .fc-today-button
      to .65, which drops both below the floor.
   -------------------------------------------------------------------------- */

/* a) DataTables buttons */
/* In this theme the DataTables export buttons render as .btn.btn-secondary
   (fill #74788d). Darken the fill so the #edf1f5 label clears 4.5:1. This also
   fixes every other .btn-secondary in the app, e.g. the "Annuler" button. */
.btn-secondary,
.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active,
.btn-secondary:disabled,
.dt-button,
.dt-buttons .btn-secondary,
div.dt-buttons .btn-secondary span {
    background-color: #686c7f !important;
    border-color: #686c7f !important;
    color: #edf1f5 !important;
}
.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #565a6b !important;
    border-color: #565a6b !important;
}

/* b) Pagination */
.page-link {
    color: #525c69 !important;
}
/* Active page number: white on the #525ce5 fill = 5.22:1. */
.page-item.active .page-link,
.page-item.active .page-link:hover,
.page-item.active .page-link:focus {
    color: #ffffff !important;
    background-color: #525ce5 !important;
    border-color: #525ce5 !important;
}
.page-link:hover,
.page-link:focus {
    color: #1f2937 !important;
    background-color: #eef0f4 !important;
}
/* Disabled controls: Bootstrap's #ced4da is 1.49:1 and effectively invisible. */
.page-link.disabled,
.page-link:disabled,
.page-item.disabled .page-link,
.page-link[aria-disabled="true"] {
    color: #6c757d !important;
    background-color: #ffffff !important;
    opacity: 1 !important;
}

/* c) Solid buttons carrying white text */
.btn-success { background-color: #188561 !important; border-color: #188561 !important; color: #fff !important; }
.btn-danger  { background-color: #e91212 !important; border-color: #e91212 !important; color: #fff !important; }
.btn-warning { background-color: #9f6a0f !important; border-color: #9f6a0f !important; color: #fff !important; }
.btn-info    { background-color: #1f78c7 !important; border-color: #1f78c7 !important; color: #fff !important; }
.btn-success:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover,
.btn-success:focus, .btn-danger:focus, .btn-warning:focus, .btn-info:focus {
    filter: brightness(0.92);
}

/* d) Soft badges: darken the text, keep the tint */
.badge-soft-danger  { color: #cc1010 !important; background-color: #fcdfdf !important; }
.badge-soft-success { color: #167b59 !important; background-color: #d8f7ec !important; }
.badge-soft-warning { color: #96640e !important; background-color: #fdf3e0 !important; }
.badge-soft-info    { color: #1d6db5 !important; background-color: #e0f0fc !important; }
.badge-soft-primary { color: #4c56e4 !important; background-color: #e7e8fc !important; }

/* e) Active breadcrumb */
.breadcrumb-item.active,
.breadcrumb-item.active a {
    color: #ffffff !important;
}

/* f) FullCalendar's own dimming */
/* FullCalendar sets opacity:.3 on the out-of-month CELL. Override on the
   cell - putting it on the day number instead multiplied the two. */
.fc-other-month,
.fc-day-other,
td.fc-other-month,
th.fc-other-month {
    opacity: 0.8 !important;   /* 4.79:1, still visibly recessed */
}
.fc-today-button,
.fc .fc-today-button {
    opacity: 1 !important;
}
.fc-event,
.fc-event .fc-title {
    color: #ffffff !important;
}
