/* ==============================================================
 * Modern Cards — global design system
 * --------------------------------------------------------------
 * Applies the polished card style (used on /president/reports)
 * to every .card across the system. Loaded after style.css and
 * before accessibility-fixes.css.
 *
 * Goals:
 *   - Soft 16px radius, subtle border, deep on-hover shadow
 *   - Smooth lift on hover (no jank)
 *   - Same look in LTR + RTL + dark mode
 *   - Respect prefers-reduced-motion (W3C WAI 2.3.3)
 *   - Visible focus-ring (W3C WAI 2.4.7)
 *
 * Opt-out per card: add class `.no-modern` to keep legacy look.
 * ============================================================== */

/* ─────────────────────────────────────────────────────────────
 * 1) Card surface — base
 * ──────────────────────────────────────────────────────────── */
.card:not(.no-modern) {
    background: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 16px !important;
    box-shadow:
        0 1px 2px rgba(17, 24, 39, .04),
        0 1px 3px rgba(17, 24, 39, .03);
    overflow: hidden;
    transition:
        transform .25s cubic-bezier(.2,.8,.25,1),
        box-shadow .25s ease,
        border-color .25s ease;
}

/* Hover lift — only on cards that the user can actually interact with
   (cards without inner buttons/links stay still to avoid useless motion). */
.card:not(.no-modern):hover,
.card:not(.no-modern):focus-within {
    transform: translateY(-3px);
    box-shadow:
        0 18px 40px -12px rgba(17, 24, 39, .14),
        0 4px 10px -4px rgba(17, 24, 39, .06);
    border-color: transparent;
}

/* Static cards (e.g. KPI tiles in a grid that aren't actionable) — */
.card.static,
.card.no-hover {
    transform: none !important;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .04) !important;
}

/* ─────────────────────────────────────────────────────────────
 * 2) Card-header — clean and tight
 * ──────────────────────────────────────────────────────────── */
.card:not(.no-modern) > .card-header {
    background: #fff;
    border-bottom: 1px solid #f1f3f6;
    padding: 16px 22px;
    font-weight: 600;
}
.card:not(.no-modern) > .card-header h1,
.card:not(.no-modern) > .card-header h2,
.card:not(.no-modern) > .card-header h3,
.card:not(.no-modern) > .card-header h4,
.card:not(.no-modern) > .card-header h5,
.card:not(.no-modern) > .card-header h6 {
    margin: 0;
    color: #1f2937;
    letter-spacing: -.005em;
    font-weight: 700;
}

/* Card-body / card-block */
.card:not(.no-modern) > .card-body,
.card:not(.no-modern) > .card-block {
    padding: 22px;
}

/* Card-footer */
.card:not(.no-modern) > .card-footer {
    background: #fafbfc;
    border-top: 1px solid #f1f3f6;
    padding: 14px 22px;
}

/* ─────────────────────────────────────────────────────────────
 * 3) "bitcoin-wallet" KPI tiles — keep their gradient,
 *    just upgrade the shadow + radius
 * ──────────────────────────────────────────────────────────── */
.card.bitcoin-wallet:not(.no-modern) {
    border-radius: 16px !important;
    border: 0;
    box-shadow:
        0 8px 22px -8px rgba(17, 24, 39, .18),
        0 3px 8px -3px rgba(17, 24, 39, .08);
    overflow: hidden;
    position: relative;
}
.card.bitcoin-wallet:not(.no-modern):hover {
    transform: translateY(-3px);
    box-shadow:
        0 22px 48px -12px rgba(17, 24, 39, .26),
        0 6px 14px -4px rgba(17, 24, 39, .12);
}
.card.bitcoin-wallet::after {
    content: "";
    position: absolute;
    inset-inline-end: -30px; top: -30px;
    width: 120px; height: 120px;
    background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent 70%);
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
 * 4) Buttons inside cards — keep their primary style but
 *    softer corners and clearer focus
 * ──────────────────────────────────────────────────────────── */
.card .btn { border-radius: 8px; }
.card .btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .35);
}

/* ─────────────────────────────────────────────────────────────
 * 5) Tables inside cards — flush, modern dividers
 * ──────────────────────────────────────────────────────────── */
.card:not(.no-modern) > .card-body > .table:first-child,
.card:not(.no-modern) > .card-block > .table:first-child,
.card:not(.no-modern) > .table-responsive > .table {
    margin-bottom: 0;
}
.card:not(.no-modern) .table thead th {
    background: #fafbfc;
    color: #4a5568;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: .82rem;
    border-bottom: 1px solid #eef0f4;
    padding: 12px 16px;
}
.card:not(.no-modern) .table tbody td {
    padding: 14px 16px;
    border-color: #f3f4f6;
}
.card:not(.no-modern) .table tbody tr:last-child td { border-bottom: 0; }

/* ─────────────────────────────────────────────────────────────
 * 6) RTL — the inline-end shadow needs the same treatment
 *    (handled by inset-inline-* — modern browsers only)
 * ──────────────────────────────────────────────────────────── */
[dir="rtl"] .card.bitcoin-wallet::after {
    inset-inline-end: -30px;
    inset-inline-start: auto;
}

/* ─────────────────────────────────────────────────────────────
 * 7) Reduce motion (W3C WAI 2.3.3)
 * ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .card:not(.no-modern),
    .card.bitcoin-wallet:not(.no-modern) { transition: none !important; }
    .card:not(.no-modern):hover,
    .card.bitcoin-wallet:not(.no-modern):hover { transform: none; }
}

/* ─────────────────────────────────────────────────────────────
 * 8) Dark theme parity
 * ──────────────────────────────────────────────────────────── */
html[data-theme="dark"] .card:not(.no-modern) {
    background: #1f2937;
    border-color: #374151;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, .35),
        0 1px 3px rgba(0, 0, 0, .2);
}
html[data-theme="dark"] .card:not(.no-modern):hover,
html[data-theme="dark"] .card:not(.no-modern):focus-within {
    box-shadow:
        0 18px 40px -12px rgba(0, 0, 0, .55),
        0 4px 10px -4px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .card:not(.no-modern) > .card-header {
    background: #1f2937;
    border-bottom-color: #374151;
    color: #e5e7eb;
}
html[data-theme="dark"] .card:not(.no-modern) > .card-header h1,
html[data-theme="dark"] .card:not(.no-modern) > .card-header h2,
html[data-theme="dark"] .card:not(.no-modern) > .card-header h3,
html[data-theme="dark"] .card:not(.no-modern) > .card-header h4,
html[data-theme="dark"] .card:not(.no-modern) > .card-header h5,
html[data-theme="dark"] .card:not(.no-modern) > .card-header h6 { color: #f3f4f6; }
html[data-theme="dark"] .card:not(.no-modern) > .card-footer {
    background: #1a212c;
    border-top-color: #374151;
}
html[data-theme="dark"] .card:not(.no-modern) .table thead th {
    background: #1a212c;
    color: #d1d5db;
    border-bottom-color: #374151;
}
html[data-theme="dark"] .card:not(.no-modern) .table tbody td {
    border-color: #2c3441;
    color: #e5e7eb;
}

/* ─────────────────────────────────────────────────────────────
 * 9) Generic clickable card pattern — for views that want
 *    the "report-card" look beyond /president/reports.
 * ──────────────────────────────────────────────────────────── */
.modern-card {
    position: relative;
    display: block;
    height: 100%;
    padding: 22px;
    background: #fff;
    border: 1px solid #eef0f4;
    border-radius: 16px;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    overflow: hidden;
    transition:
        transform .25s cubic-bezier(.2,.8,.25,1),
        box-shadow .25s ease,
        border-color .25s ease;
}
.modern-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--accent, #4f46e5);
    opacity: 0;
    transition: opacity .25s ease, width .25s ease;
}
.modern-card::after {
    content: "";
    position: absolute;
    inset-inline-end: -40px; top: -40px;
    width: 140px; height: 140px;
    background: radial-gradient(closest-side, var(--accent, #4f46e5), transparent 70%);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
.modern-card:hover,
.modern-card:focus-visible {
    transform: translateY(-4px);
    box-shadow:
        0 18px 40px -12px rgba(17, 24, 39, .14),
        0 4px 10px -4px rgba(17, 24, 39, .06);
    border-color: transparent;
    outline: none;
}
.modern-card:focus-visible {
    box-shadow:
        0 0 0 3px rgba(79, 70, 229, .35),
        0 18px 40px -12px rgba(17, 24, 39, .14);
}
.modern-card:hover::before,
.modern-card:focus-visible::before { opacity: 1; width: 6px; }
.modern-card:hover::after { opacity: .12; }

.modern-card .card-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: grid; place-items: center;
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent, #4f46e5) 0%, var(--accent-dark, #312e81) 100%);
    box-shadow: 0 6px 16px -4px var(--accent-shadow, rgba(79, 70, 229, .35));
    transition: transform .25s ease;
}
.modern-card:hover .card-icon { transform: scale(1.06) rotate(-3deg); }

.modern-card .card-title-text {
    font-size: 1rem; font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
    letter-spacing: -.005em;
    line-height: 1.35;
}
.modern-card .card-desc {
    font-size: .82rem;
    color: #6b7280;
    line-height: 1.65;
}
.modern-card .card-arrow {
    position: absolute;
    top: 22px;
    inset-inline-end: 22px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #9ca3af;
    display: grid; place-items: center;
    font-size: .82rem;
    transition: all .25s ease;
}
.modern-card:hover .card-arrow {
    background: var(--accent, #4f46e5);
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .modern-card,
    .modern-card .card-icon,
    .modern-card .card-arrow { transition: none; }
    .modern-card:hover { transform: none; }
    .modern-card:hover .card-icon { transform: none; }
}

html[data-theme="dark"] .modern-card { background: #1f2937; border-color: #374151; }
html[data-theme="dark"] .modern-card .card-title-text { color: #f9fafb; }
html[data-theme="dark"] .modern-card .card-desc { color: #9ca3af; }
html[data-theme="dark"] .modern-card .card-arrow { background: #374151; color: #9ca3af; }

/* End modern-cards.css */
