/* ==========================================================================
   Prêt Feu Go — design system
   Warm palette anchored on the historical brand orange (#E95912).
   No build step: plain CSS overriding Bootstrap 5.3 CSS variables.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    --pfg-primary: #E95912;        /* brand orange */
    --pfg-primary-dark: #C4490D;   /* hover, headings (AA on cream) */
    --pfg-primary-darker: #A03A08;
    --pfg-accent: #177E74;         /* muted teal: revenus, edit actions */
    --pfg-accent-dark: #10635B;
    --pfg-bg: #FAF6F1;             /* warm paper */
    --pfg-surface: #FFFFFF;
    --pfg-surface-muted: #F5EFE7;  /* clôturés / inactifs */
    --pfg-border: #EADFD2;
    --pfg-ink: #3E332A;            /* warm near-black */
    --pfg-ink-muted: #8A7B6C;
    --pfg-danger: #B3402A;         /* brick: dépenses, delete */
    --pfg-table-head: #FBEEE4;     /* sticky table headers */
    --pfg-shadow: 0 1px 3px rgba(62, 51, 42, .08);

    /* Bootstrap 5.3 root variables */
    --bs-body-bg: var(--pfg-bg);
    --bs-body-color: var(--pfg-ink);
    --bs-secondary-color: var(--pfg-ink-muted);
    --bs-border-color: var(--pfg-border);
    --bs-border-radius: .5rem;
    --bs-link-color: var(--pfg-primary-dark);
    --bs-link-color-rgb: 196, 73, 13;
    --bs-link-hover-color: var(--pfg-primary-darker);
    --bs-link-hover-color-rgb: 160, 58, 8;
    --bs-primary: #E95912;
    --bs-primary-rgb: 233, 89, 18;
    --bs-heading-color: var(--pfg-primary-dark);
}

body {
    background: var(--pfg-bg);
}

h2 {
    padding-bottom: .5rem;
    padding-top: .5rem;
}

h3 {
    padding-bottom: .5rem;
}

/* --------------------------------------------------------------------------
   2. Bootstrap component variable overrides
   -------------------------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: var(--pfg-primary);
    --bs-btn-border-color: var(--pfg-primary);
    --bs-btn-hover-bg: var(--pfg-primary-dark);
    --bs-btn-hover-border-color: var(--pfg-primary-dark);
    --bs-btn-active-bg: var(--pfg-primary-darker);
    --bs-btn-active-border-color: var(--pfg-primary-darker);
    --bs-btn-disabled-bg: var(--pfg-primary);
    --bs-btn-disabled-border-color: var(--pfg-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--pfg-primary-dark);
    --bs-btn-border-color: var(--pfg-primary);
    --bs-btn-hover-bg: var(--pfg-primary);
    --bs-btn-hover-border-color: var(--pfg-primary);
    --bs-btn-active-bg: var(--pfg-primary-dark);
    --bs-btn-active-border-color: var(--pfg-primary-dark);
}

.btn-outline-secondary {
    --bs-btn-color: var(--pfg-ink-muted);
    --bs-btn-border-color: var(--pfg-border);
    --bs-btn-hover-bg: var(--pfg-surface-muted);
    --bs-btn-hover-border-color: var(--pfg-ink-muted);
    --bs-btn-hover-color: var(--pfg-ink);
    --bs-btn-active-bg: var(--pfg-surface-muted);
    --bs-btn-active-color: var(--pfg-ink);
}

.pagination {
    --bs-pagination-color: var(--pfg-primary-dark);
    --bs-pagination-active-bg: var(--pfg-primary);
    --bs-pagination-active-border-color: var(--pfg-primary);
    --bs-pagination-hover-color: var(--pfg-primary-darker);
    --bs-pagination-focus-color: var(--pfg-primary-darker);
    --bs-pagination-border-color: var(--pfg-border);
}

.card {
    --bs-card-border-color: var(--pfg-border);
    --bs-card-bg: var(--pfg-surface);
    box-shadow: var(--pfg-shadow);
}

.card .card-header {
    background: transparent;
    border-bottom-color: var(--pfg-border);
}

/* Muted variant for closed / inactive sections */
.pfg-card--muted {
    --bs-card-bg: var(--pfg-surface-muted);
    box-shadow: none;
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--pfg-primary);
    --bs-nav-link-color: var(--pfg-primary-dark);
    --bs-nav-link-hover-color: var(--pfg-primary-darker);
}

.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--pfg-primary);
    --bs-dropdown-border-color: var(--pfg-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--pfg-primary);
    box-shadow: 0 0 0 .25rem rgba(233, 89, 18, .25);
}

.form-check-input:checked {
    background-color: var(--pfg-primary);
    border-color: var(--pfg-primary);
}

/* MoneyWidget under crispy: amount input and currency select on one row */
#div_id_amount fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

#div_id_amount legend {
    flex-basis: 100%;
    margin-bottom: .25rem;
}

#div_id_amount input[name$="_0"] {
    flex: 2 1 8rem;
    width: auto;
}

#div_id_amount select[name$="_1"] {
    flex: 1 1 6rem;
    width: auto;
}

/* --------------------------------------------------------------------------
   3. Navbar
   -------------------------------------------------------------------------- */
#navbar-lolo {
    background: var(--pfg-surface);
    border-bottom: 3px solid var(--pfg-primary);
    box-shadow: var(--pfg-shadow);
}

#navbar-lolo .navbar-brand {
    color: var(--pfg-primary-dark);
    font-weight: 700;
}

#navbar-lolo .navbar-brand img {
    height: 1.6rem;
    margin-right: .4rem;
}

#navbar-lolo .nav-link {
    color: var(--pfg-ink);
}

#navbar-lolo .nav-link.active {
    color: var(--pfg-primary-dark);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   4. Quick-add FAB (mobile only, used from Phase 3 nav)
   -------------------------------------------------------------------------- */
.pfg-fab {
    position: fixed;
    right: 1rem;
    bottom: 1.25rem;
    z-index: 1030;
    text-decoration: none;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    background: var(--pfg-primary);
    box-shadow: 0 2px 8px rgba(62, 51, 42, .3);
}

.pfg-fab:hover,
.pfg-fab:focus {
    color: #fff;
    background: var(--pfg-primary-dark);
}

@media (max-width: 991.98px) {
    /* keep the FAB clear of page content */
    main {
        padding-bottom: 6rem !important;
    }
}

/* --------------------------------------------------------------------------
   5. Tables
   -------------------------------------------------------------------------- */
.table-fixed {
    max-height: 700px;
    overflow: auto;                    /* both axes: wide tables scroll inside */
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table-fixed th {
    position: sticky;
    top: 0;
    z-index: 2;                        /* under the sticky navbar (1020+) */
    background-color: var(--pfg-table-head) !important;
    border-bottom: 1px solid var(--pfg-ink-muted);
}

.custom-table {
    text-align: center;
}

.delete-icon {
    color: var(--pfg-danger);
}

.edit-icon {
    color: var(--pfg-accent);
}

/* Amounts: dépenses vs revenus */
.pfg-amount-depense {
    color: var(--pfg-danger);
}

.pfg-amount-revenu {
    color: var(--pfg-accent-dark);
}

/* Compact user initial shown instead of the Nom column on phones */
.pfg-user-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    margin-right: .35rem;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 700;
    color: var(--pfg-primary-dark);
    background: var(--pfg-table-head);
    border: 1px solid var(--pfg-border);
}

/* --------------------------------------------------------------------------
   6. Analyse page
   -------------------------------------------------------------------------- */
.summary-row,
.total-column {
    background-color: var(--pfg-surface-muted) !important;
    font-weight: bold;
}

.table-fixed tbody td.total-column {
    background-color: var(--pfg-surface-muted) !important;
    font-weight: bold;
}

/* Charts: fixed-height responsive boxes (Chart.js maintainAspectRatio:false) */
.pfg-chart-box {
    position: relative;
    height: 260px;
}

/* Wide pivot: keep the category column readable while scrolling months */
.pfg-sticky-first th:first-child,
.pfg-sticky-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: var(--pfg-surface);
}

.pfg-sticky-first thead th:first-child {
    z-index: 3; /* above both the sticky header row and the sticky column */
    background-color: var(--pfg-table-head) !important;
}

/* Budget vs réel cell tints — colors mirror the budgets page row tints.
   Must stay AFTER the total-column rules (equal specificity, last wins) so
   tints also apply to YTD/12M cells; green is deliberately untinted. */
.table-fixed tbody td.budget-cell-yellow { background-color: #FCF3DE !important; }
.table-fixed tbody td.budget-cell-red    { background-color: #FAE3DA !important; }
.table-fixed tbody td.budget-cell-over   { background-color: #F5D2C4 !important; }

/* --------------------------------------------------------------------------
   7. Budgets page (absorbed from budgets.html inline styles)
   -------------------------------------------------------------------------- */
.budget-row-yellow td { background-color: #FCF3DE; }
.budget-row-red td    { background-color: #FAE3DA; }
.budget-row-over td   { background-color: #F5D2C4; }

.budget-bar-green  { background-color: #6A994E; }
.budget-bar-yellow { background-color: #E9C46A; color: var(--pfg-ink); }
.budget-bar-red    { background-color: var(--pfg-danger); }
.budget-bar-over   { background-color: #7A1F0E; }

.budget-progress { min-width: 110px; }
.budget-totals td { font-weight: bold; }

/* Inline per-row budget edit */
.pfg-budget-input { width: 6rem; }

/* Current month in the budgets header nav */
.pfg-month-current {
    color: var(--pfg-primary-dark);
    border-color: var(--pfg-border);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   7b. Willywine tasting cards
   -------------------------------------------------------------------------- */
.pfg-tasting-pictures {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top-left-radius: var(--bs-border-radius);
    border-top-right-radius: var(--bs-border-radius);
    background: var(--pfg-surface-muted);
}

.pfg-tasting-pictures img {
    height: 140px;
    width: auto;
    flex: 0 0 auto;
    object-fit: cover;
}

/* --------------------------------------------------------------------------
   8. Page helpers
   -------------------------------------------------------------------------- */
#searchbar {
    padding-bottom: 20px;
}

.sublabel {
    color: var(--pfg-primary);
    font-weight: bold;
    padding-top: 5px;
}

