/* =====================================================================
   Recups FCINQ v2 — styles
   Palette basee sur fcinq.com
   ===================================================================== */

:root {
    --c-bg: #f5f2ea;
    --c-ink: #151515;
    --c-ink-2: #222429;
    --c-muted: #5e6473;
    --c-mint: #fdc064;
    --c-amber: #fdc064;
    --c-white: #fff;
    --c-border: #e5e0d3;

    --radius: 16px;
    --radius-sm: 10px;

    --pad: clamp(20px, 4vw, 40px);
    --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Helvetica, Arial, sans-serif;
    --font-serif: 'Instrument Serif', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
}

a { color: inherit; }

.serif {
    font-family: var(--font-serif);
    font-weight: 400;
    font-style: italic;
}

/* ---------- Header ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px var(--pad);
    background: var(--c-ink);
    color: var(--c-white);
}
.app-header__brand {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.app-header__logo {
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.02em;
}
.app-header__logo-sub {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--c-mint);
    font-size: 20px;
}
.app-header__nav {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}
.app-header__nav a {
    text-decoration: none;
    color: var(--c-white);
    opacity: 0.85;
}
.app-header__nav a:hover { opacity: 1; }
.app-header__user {
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.2);
    color: var(--c-muted);
}
.app-header__logout {
    background: var(--c-mint);
    color: var(--c-ink) !important;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    opacity: 1 !important;
}

/* ---------- Wrap ---------- */
.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--pad);
}

/* ---------- Hero ---------- */
.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 40px;
}
.hero__eyebrow {
    margin: 0 0 8px;
    color: var(--c-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hero__title {
    margin: 0;
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.hero__num {
    color: var(--c-ink);
    font-style: italic;
    margin: 0 0.1em;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }

.btn--primary { background: var(--c-ink); color: var(--c-white); }
.btn--primary:hover:not(:disabled) { background: var(--c-ink-2); }

.btn--accent { background: var(--c-mint); color: var(--c-ink); }
.btn--accent:hover:not(:disabled) { background: #eba848; }

.btn--outline { background: transparent; border-color: var(--c-ink); color: var(--c-ink); }
.btn--outline:hover:not(:disabled) { background: var(--c-ink); color: var(--c-white); }

.btn--ghost { background: transparent; color: var(--c-muted); }
.btn--ghost:hover { color: var(--c-ink); }

.btn--sm { padding: 8px 14px; font-size: 13px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form__row { display: flex; flex-direction: column; gap: 6px; }
.form__row > span { font-size: 13px; font-weight: 500; color: var(--c-muted); }
.form input {
    padding: 12px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-white);
    font-family: inherit;
    font-size: 15px;
    color: var(--c-ink);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form input:focus {
    border-color: var(--c-ink);
    box-shadow: 0 0 0 3px rgba(253,192,100,0.35);
}
.form__hint { margin: -4px 0 0; font-size: 12px; color: var(--c-muted); }
.form__actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert--error { background: #ffe1de; color: #7a1a10; }
.alert--success { background: #d7ffe9; color: #0a5b32; }

/* ---------- Auth pages ---------- */
.page-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--pad);
}
.auth-wrap { width: 100%; max-width: 440px; }
.auth-card {
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(21, 21, 21, 0.08);
}
.auth-card__title {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.auth-card__sub {
    margin: 0 0 28px;
    color: var(--c-muted);
    font-size: 14px;
}
.auth-card__footer {
    margin: 24px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--c-muted);
}
.auth-card__footer a { color: var(--c-ink); font-weight: 500; }

/* ---------- Dashboard ---------- */
.card-list__title {
    margin: 0 0 16px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-muted);
}
.recups {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.recup {
    background: var(--c-white);
    padding: 24px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    min-height: 140px;
}
.recup__projet {
    font-weight: 600;
    font-size: 17px;
    color: var(--c-ink);
    letter-spacing: -0.01em;
}
.recup__days {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--c-ink);
}
.recup__days-num {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 44px;
    line-height: 1;
    color: var(--c-ink);
}
.recup__days-label {
    color: var(--c-muted);
    font-size: 14px;
}
.recup__deadline {
    font-size: 12px;
    color: var(--c-muted);
    padding-top: 12px;
    border-top: 1px solid var(--c-border);
}
.recup__deadline--expired {
    color: #c62828;
    font-weight: 600;
}
.recup--expired { box-shadow: inset 0 0 0 1px rgba(198,40,40,0.25); }

.detail-table .is-expired { color: #c62828; font-weight: 600; }

.empty {
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--c-muted);
}

/* ---------- Admin ---------- */
.filter { display: flex; gap: 12px; }
.filter label { display: flex; flex-direction: column; gap: 4px; }
.filter span { font-size: 12px; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.filter select {
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-white);
    font-family: inherit;
    font-size: 14px;
    color: var(--c-ink);
    min-width: 220px;
}

.rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
    background: var(--c-white);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.row:hover { box-shadow: 0 4px 20px rgba(21,21,21,0.06); }
.row__main {
    display: grid;
    grid-template-columns: 40px 1fr 140px auto;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
}
.row__toggle {
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-ink);
    font-size: 24px;
    line-height: 1;
    transition: background 0.15s ease, transform 0.2s ease;
}
.row__toggle:disabled { opacity: 0.2; cursor: default; }
.row__toggle:not(:disabled):hover { background: var(--c-bg); }
.row.-open .row__toggle { transform: rotate(90deg); }
.row.-open .row__toggle { background: var(--c-bg); }
.row__chevron { display: block; }
.row__name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.row__count { display: flex; align-items: baseline; gap: 4px; }
.row__count-num { font-family: var(--font-serif); font-style: italic; font-size: 28px; line-height: 1; }
.row__count-label { font-size: 12px; color: var(--c-muted); }
.row__actions { display: flex; gap: 8px; flex-shrink: 0; }
.row__detail {
    padding: 0 24px 20px 80px;
    border-top: 1px solid var(--c-border);
    background: #faf8f2;
}
.detail-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.detail-table th, .detail-table td { text-align: left; padding: 10px 12px; }
.detail-table th { color: var(--c-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-table tr + tr td { border-top: 1px solid var(--c-border); }

/* ---------- History ---------- */
.history-table { width: 100%; border-collapse: collapse; background: var(--c-white); border-radius: var(--radius); overflow: hidden; }
.history-table th, .history-table td { padding: 14px 18px; text-align: left; font-size: 14px; }
.history-table thead th { background: #ede9dc; color: var(--c-muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; font-weight: 500; }
.history-table tbody tr + tr td { border-top: 1px solid var(--c-border); }

.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag--add { background: rgba(253,192,100,0.3); color: #7a4a10; }
.tag--take { background: rgba(253,192,100,0.35); color: #7a4a10; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
}
.pagination__info { color: var(--c-muted); font-size: 13px; }
.pagination__list {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}
.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--c-white);
    color: var(--c-ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.pagination__link:hover:not(.pagination__link--disabled):not(.pagination__link--current) {
    background: var(--c-ink);
    color: var(--c-white);
}
.pagination__link--current {
    background: var(--c-ink);
    color: var(--c-white);
    cursor: default;
}
.pagination__link--disabled {
    color: var(--c-muted);
    opacity: 0.5;
    cursor: not-allowed;
}
.pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: var(--c-muted);
}

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(21,21,21,0.5); backdrop-filter: blur(3px); }
.modal__card {
    position: relative;
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 30px 80px rgba(21,21,21,0.25);
}
.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--c-muted);
    padding: 8px;
}
.modal__title { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.modal__sub { margin: 0 0 20px; color: var(--c-muted); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .row__main { grid-template-columns: 32px 1fr; }
    .row__count, .row__actions { grid-column: 2 / -1; }
    .row__detail { padding-left: 24px; }
    .filter { flex-direction: column; }

    /* Header : brand au-dessus, menu en-dessous */
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px var(--pad);
    }
    .app-header__nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 12px 16px;
        align-items: center;
    }
    .app-header__user { display: none; }
    .app-header__logout { margin-left: auto; }
}
