/* ==========================================================
   EDG PREMIUM UI — fintech-grade design system
   ========================================================== */

:root {
    --edg-blue: #0a3d8f;
    --edg-blue-dark: #062a66;
    --edg-blue-light: #1a5fc4;
    --edg-cyan: #2bb3ff;
    --edg-green: #16a34a;
    --edg-green-light: #22c55e;
    --edg-red: #e53935;
    --edg-amber: #f59e0b;
    --edg-yellow: #fbbf24;
    --edg-bg: #f4f7fc;
    --edg-bg-2: #eef2f9;
    --edg-card: #ffffff;
    --edg-text: #0f172a;
    --edg-muted: #64748b;
    --edg-border: #e5edf7;
    --edg-shadow-sm: 0 2px 8px rgba(10, 61, 143, .06);
    --edg-shadow: 0 10px 30px rgba(10, 61, 143, .10);
    --edg-shadow-lg: 0 20px 60px rgba(10, 61, 143, .18);
    --edg-radius: 18px;
    --edg-radius-sm: 12px;
    --edg-radius-lg: 26px;
    --edg-grad-blue: linear-gradient(135deg, #0a3d8f 0%, #1a5fc4 50%, #2bb3ff 100%);
    --edg-grad-green: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
    --edg-grad-amber: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --edg-grad-bg: radial-gradient(1100px 600px at 10% -10%, #d6e4ff 0%, transparent 60%),
                   radial-gradient(900px 500px at 110% 10%, #cfeaff 0%, transparent 55%),
                   linear-gradient(180deg, #f4f7fc 0%, #eef2f9 100%);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

.edg-body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--edg-text);
    background: var(--edg-grad-bg);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
    font-family: 'Poppins', 'Inter', sans-serif;
    color: var(--edg-text);
    letter-spacing: -.01em;
}

/* === TOPBAR === */
.edg-topbar {
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--edg-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.edg-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--edg-text); }
.edg-brand:hover { color: var(--edg-blue); }
.edg-logo {
    width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--edg-grad-blue);
    color: #fff; border-radius: 12px; font-size: 1.2rem;
    box-shadow: 0 8px 18px rgba(10, 61, 143, .25);
}
.edg-logo.small { width: 36px; height: 36px; font-size: 1rem; }
.edg-brand-text strong { display: block; font-family: 'Poppins'; font-weight: 700; font-size: 1.05rem; line-height: 1; }
.edg-brand-text small { display: block; color: var(--edg-muted); font-size: .72rem; margin-top: 2px; }

.edg-nav a {
    text-decoration: none; color: var(--edg-text); font-weight: 500; font-size: .92rem;
    padding: .45rem .9rem; border-radius: 10px; transition: all .2s;
}
.edg-nav a:hover { background: var(--edg-bg-2); color: var(--edg-blue); }
.edg-nav a i { margin-right: 6px; opacity: .7; }
.edg-secure-badge {
    background: rgba(22, 163, 74, .1); color: var(--edg-green);
    padding: .4rem .8rem; border-radius: 30px; font-size: .76rem; font-weight: 600;
}

.edg-mobile-nav a {
    display: block; padding: .9rem 1rem; color: var(--edg-text); text-decoration: none;
    border-radius: 12px; font-weight: 500; margin-bottom: .25rem;
}
.edg-mobile-nav a:hover { background: var(--edg-bg-2); color: var(--edg-blue); }
.edg-mobile-nav a i { width: 26px; color: var(--edg-blue); }

/* === MAIN === */
.edg-main { padding: 2rem 0 4rem; min-height: calc(100vh - 200px); }

/* === HERO HOME === */
.edg-hero {
    text-align: center; padding: 2.4rem 1rem 1.6rem;
}
.edg-hero h1 {
    font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800;
    background: var(--edg-grad-blue); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: .6rem;
}
.edg-hero p { color: var(--edg-muted); font-size: 1.05rem; max-width: 720px; margin: 0 auto; }

/* === PREMIUM CARDS (HOME) === */
.edg-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.8rem; max-width: 980px; margin: 0 auto; }
@media (max-width: 768px) { .edg-choice-grid { grid-template-columns: 1fr; } }

.edg-choice-card {
    position: relative; padding: 2.4rem 2rem 2rem;
    background: #fff; border-radius: var(--edg-radius-lg);
    box-shadow: var(--edg-shadow);
    border: 1px solid var(--edg-border);
    overflow: hidden; cursor: pointer; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .35s;
    display: flex; flex-direction: column; gap: 1rem;
}
.edg-choice-card::before {
    content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .35s;
    background: linear-gradient(135deg, rgba(10,61,143,.04), rgba(43,179,255,.06));
    pointer-events: none;
}
.edg-choice-card:hover { transform: translateY(-8px); box-shadow: var(--edg-shadow-lg); border-color: rgba(10,61,143,.25); }
.edg-choice-card:hover::before { opacity: 1; }

.edg-choice-icon {
    width: 78px; height: 78px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 2rem; box-shadow: 0 14px 30px rgba(10,61,143,.25);
}
.edg-choice-icon.blue  { background: var(--edg-grad-blue); }
.edg-choice-icon.green { background: var(--edg-grad-green); box-shadow: 0 14px 30px rgba(34,197,94,.3); }
.edg-choice-icon.amber { background: var(--edg-grad-amber); box-shadow: 0 14px 30px rgba(245,158,11,.3); }

.edg-choice-card h3 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.edg-choice-card p { color: var(--edg-muted); margin: 0; }

.edg-choice-features { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.edg-choice-features span {
    background: var(--edg-bg-2); color: var(--edg-blue-dark);
    padding: .25rem .65rem; border-radius: 30px; font-size: .76rem; font-weight: 500;
}

.edg-choice-cta {
    margin-top: auto; display: inline-flex; align-items: center; gap: 8px; padding: .85rem 1.4rem;
    background: var(--edg-grad-blue); color: #fff; border: 0; border-radius: 14px;
    font-weight: 600; font-size: 1rem; text-decoration: none; transition: transform .2s, box-shadow .2s;
    align-self: flex-start;
}
.edg-choice-cta:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 24px rgba(10,61,143,.25); }
.edg-choice-card.green-cta .edg-choice-cta { background: var(--edg-grad-green); }
.edg-choice-card.green-cta .edg-choice-cta:hover { box-shadow: 0 12px 24px rgba(34,197,94,.3); }

/* === STATS BANNER === */
.edg-stats {
    margin-top: 3rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; max-width: 980px; margin-left: auto; margin-right: auto;
}
@media (max-width: 720px) { .edg-stats { grid-template-columns: repeat(2, 1fr); } }
.edg-stat {
    background: #fff; padding: 1.1rem 1.2rem; border-radius: var(--edg-radius-sm); border: 1px solid var(--edg-border);
    text-align: center; transition: transform .25s;
}
.edg-stat:hover { transform: translateY(-3px); box-shadow: var(--edg-shadow-sm); }
.edg-stat-num { font-family: 'Poppins'; font-weight: 700; font-size: 1.4rem; color: var(--edg-blue); }
.edg-stat-label { font-size: .78rem; color: var(--edg-muted); }

/* === WIZARD CONTAINER === */
.edg-wizard {
    max-width: 880px; margin: 0 auto; background: #fff;
    border-radius: var(--edg-radius-lg); padding: 0; box-shadow: var(--edg-shadow);
    border: 1px solid var(--edg-border); overflow: hidden;
}
.edg-wizard-header {
    background: var(--edg-grad-blue);
    color: #fff; padding: 1.4rem 1.6rem; position: relative;
}
.edg-wizard-header.green { background: var(--edg-grad-green); }
.edg-wizard-header h2 { color: #fff; margin: 0 0 .2rem; font-size: 1.3rem; font-weight: 700; }
.edg-wizard-header p { margin: 0; font-size: .9rem; opacity: .9; }
.edg-wizard-back { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 50%; }
.edg-wizard-back:hover { background: rgba(255,255,255,.28); color: #fff; }

/* progress */
.edg-progress {
    display: flex; padding: 1.2rem 1.6rem 0; gap: 8px; flex-wrap: nowrap;
    background: #fff; border-bottom: 1px solid var(--edg-border);
}
.edg-step-dot { flex: 1; min-width: 0; }
.edg-step-bar {
    height: 6px; border-radius: 6px; background: #e1e9f6;
    transition: background .4s;
}
.edg-step-dot.done .edg-step-bar { background: var(--edg-green); }
.edg-step-dot.active .edg-step-bar { background: var(--edg-blue); box-shadow: 0 0 0 3px rgba(10,61,143,.15); }
.edg-step-label {
    font-size: .68rem; color: var(--edg-muted); margin-top: 6px; text-align: center; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 12px;
}
.edg-step-dot.active .edg-step-label, .edg-step-dot.done .edg-step-label { color: var(--edg-text); font-weight: 600; }

.edg-wizard-body { padding: 2rem 1.8rem; }
@media (max-width: 576px) { .edg-wizard-body { padding: 1.4rem 1.1rem; } }

.edg-step-pane { display: none; animation: fadeUp .45s cubic-bezier(.2,.8,.2,1); }
.edg-step-pane.active { display: block; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* === FORMS === */
.edg-form-group { margin-bottom: 1.2rem; }
.edg-label {
    display: block; font-weight: 600; color: var(--edg-text); font-size: .88rem; margin-bottom: .45rem;
}
.edg-input, .edg-select {
    width: 100%; padding: .85rem 1rem; border-radius: 14px; border: 1.5px solid var(--edg-border);
    background: #fff; font-size: 1rem; transition: all .2s; font-family: inherit;
}
.edg-input:focus, .edg-select:focus {
    outline: none; border-color: var(--edg-blue); box-shadow: 0 0 0 4px rgba(10,61,143,.10);
}
.edg-input.error, .edg-select.error { border-color: var(--edg-red); box-shadow: 0 0 0 4px rgba(229,57,53,.10); }
.edg-input.success { border-color: var(--edg-green); }

.edg-input-group {
    display: flex; align-items: stretch; border-radius: 14px; border: 1.5px solid var(--edg-border); overflow: hidden;
    transition: all .2s;
}
.edg-input-group:focus-within { border-color: var(--edg-blue); box-shadow: 0 0 0 4px rgba(10,61,143,.10); }
.edg-input-group .edg-input { border: 0; box-shadow: none; }
.edg-input-prefix {
    background: var(--edg-bg-2); padding: 0 1rem; display: flex; align-items: center; color: var(--edg-blue); font-weight: 600;
}

.edg-help { color: var(--edg-muted); font-size: .82rem; margin-top: .35rem; display: block; }
.edg-error-msg { color: var(--edg-red); font-size: .8rem; margin-top: .35rem; display: none; }
.edg-error-msg.visible { display: block; }

/* === BUTTONS === */
.edg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: .9rem 1.6rem; border-radius: 14px; border: 0; font-weight: 600; font-size: .98rem;
    cursor: pointer; transition: all .2s; text-decoration: none; line-height: 1.2;
}
.edg-btn-primary { background: var(--edg-grad-blue); color: #fff; box-shadow: 0 8px 18px rgba(10,61,143,.25); }
.edg-btn-primary:hover { transform: translateY(-2px); color: #fff; box-shadow: 0 14px 28px rgba(10,61,143,.32); }
.edg-btn-success { background: var(--edg-grad-green); color: #fff; box-shadow: 0 8px 18px rgba(22,163,74,.25); }
.edg-btn-success:hover { transform: translateY(-2px); color: #fff; box-shadow: 0 14px 28px rgba(22,163,74,.32); }
.edg-btn-ghost { background: var(--edg-bg-2); color: var(--edg-text); }
.edg-btn-ghost:hover { background: #dbe5f3; color: var(--edg-text); }
.edg-btn-outline { background: #fff; border: 1.5px solid var(--edg-border); color: var(--edg-text); }
.edg-btn-outline:hover { border-color: var(--edg-blue); color: var(--edg-blue); }
.edg-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.edg-btn-block { width: 100%; }
.edg-btn-lg { padding: 1.05rem 1.8rem; font-size: 1.05rem; }

.edg-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 1.5rem; }
.edg-actions .edg-btn { flex: 1 1 auto; min-width: 140px; }

/* === CHIPS / QUICK AMOUNTS === */
.edg-chip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: .6rem; }
@media (max-width: 576px) { .edg-chip-grid { grid-template-columns: repeat(2, 1fr); } }
.edg-chip {
    background: var(--edg-bg-2); border: 1.5px solid transparent; padding: .85rem .6rem;
    border-radius: 14px; cursor: pointer; font-weight: 600; color: var(--edg-text); font-size: .92rem;
    transition: all .2s; text-align: center;
}
.edg-chip:hover { background: #dbe5f3; border-color: var(--edg-blue-light); transform: translateY(-2px); }
.edg-chip.active { background: var(--edg-blue); color: #fff; border-color: var(--edg-blue); }

/* === INFO CARDS === */
.edg-info-card {
    background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    border: 1px solid #d8e3f7; padding: 1.4rem 1.5rem; border-radius: var(--edg-radius);
    display: flex; flex-direction: column; gap: .6rem;
}
.edg-info-card h4 { margin: 0; font-size: 1rem; color: var(--edg-blue-dark); }
.edg-info-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: .35rem 0; border-bottom: 1px dashed rgba(10,61,143,.12); font-size: .94rem; }
.edg-info-row:last-child { border: 0; }
.edg-info-row .label { color: var(--edg-muted); font-weight: 500; }
.edg-info-row .value { font-weight: 600; color: var(--edg-text); text-align: right; }
.edg-info-row .value.big { font-size: 1.15rem; color: var(--edg-blue); }

/* invoice list */
.edg-invoice-list { display: flex; flex-direction: column; gap: 12px; }
.edg-invoice-item {
    background: #fff; border: 1.5px solid var(--edg-border); border-radius: var(--edg-radius);
    padding: 1.1rem 1.3rem; cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 14px;
}
.edg-invoice-item:hover { border-color: var(--edg-blue); transform: translateY(-2px); box-shadow: var(--edg-shadow-sm); }
.edg-invoice-item.selected { border-color: var(--edg-blue); background: linear-gradient(135deg, #f0f6ff 0%, #e7eeff 100%); box-shadow: 0 0 0 3px rgba(10,61,143,.15); }
.edg-invoice-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--edg-bg-2); color: var(--edg-blue); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.edg-invoice-info { flex: 1; min-width: 0; }
.edg-invoice-info .num { font-weight: 700; color: var(--edg-text); }
.edg-invoice-info .meta { font-size: .82rem; color: var(--edg-muted); }
.edg-invoice-amount { font-weight: 700; font-size: 1.1rem; color: var(--edg-blue); white-space: nowrap; }

.edg-status-pill { padding: .15rem .55rem; border-radius: 30px; font-size: .68rem; font-weight: 600; text-transform: uppercase; }
.edg-status-pill.impaye { background: rgba(229,57,53,.12); color: var(--edg-red); }
.edg-status-pill.partielle { background: rgba(245,158,11,.15); color: var(--edg-amber); }
.edg-status-pill.paye { background: rgba(22,163,74,.15); color: var(--edg-green); }

/* === SKELETON === */
.edg-skel {
    background: linear-gradient(90deg, #eef2f9 25%, #f8fbff 50%, #eef2f9 75%);
    background-size: 200% 100%; animation: skel 1.4s infinite;
    border-radius: 8px;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.edg-skel-line { height: 14px; margin: 8px 0; }
.edg-skel-line.short { width: 50%; }
.edg-skel-line.medium { width: 80%; }

/* === LOADING ANIMATION (processing) === */
.edg-processing { text-align: center; padding: 2rem 1rem 1rem; }
.edg-spinner-ring {
    width: 96px; height: 96px; margin: 0 auto 1.4rem; position: relative;
}
.edg-spinner-ring::before, .edg-spinner-ring::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 5px solid transparent;
}
.edg-spinner-ring::before { border-top-color: var(--edg-blue); animation: spin 1.1s linear infinite; }
.edg-spinner-ring::after  { border-bottom-color: var(--edg-cyan); animation: spin 1.5s linear infinite reverse; }
.edg-spinner-ring i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--edg-blue); font-size: 1.7rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.edg-process-steps { max-width: 360px; margin: 0 auto; text-align: left; }
.edg-process-step {
    display: flex; align-items: center; gap: 12px; padding: .55rem .8rem; border-radius: 10px;
    color: var(--edg-muted); transition: all .3s; font-size: .92rem;
}
.edg-process-step .icon { width: 26px; height: 26px; border-radius: 50%; background: #eef2f9; display: flex; align-items: center; justify-content: center; color: #94a3b8; flex-shrink: 0; }
.edg-process-step.active { background: rgba(10,61,143,.06); color: var(--edg-text); font-weight: 500; }
.edg-process-step.active .icon { background: var(--edg-blue); color: #fff; }
.edg-process-step.done { color: var(--edg-text); }
.edg-process-step.done .icon { background: var(--edg-green); color: #fff; }

/* === RECEIPT === */
.edg-receipt {
    background: #fff; border-radius: var(--edg-radius); border: 2px dashed var(--edg-border); padding: 1.8rem 1.6rem;
}
.edg-receipt-head { text-align: center; padding-bottom: 1rem; border-bottom: 1px dashed var(--edg-border); }
.edg-receipt-head .check {
    width: 76px; height: 76px; border-radius: 50%; background: var(--edg-grad-green);
    color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 2.2rem;
    box-shadow: 0 14px 30px rgba(22,163,74,.3); margin-bottom: 1rem;
    animation: pop .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop { 0%{ transform: scale(0);} 100%{transform: scale(1);} }
.edg-receipt-head h2 { font-size: 1.4rem; margin: 0 0 .3rem; }
.edg-receipt-head p { color: var(--edg-muted); margin: 0; }

.edg-receipt-body { padding: 1.2rem 0; }

.edg-token {
    background: linear-gradient(135deg, #0a3d8f 0%, #2bb3ff 100%); color: #fff;
    border-radius: 16px; padding: 1.4rem; text-align: center; box-shadow: 0 14px 30px rgba(10,61,143,.25);
    margin-top: 1rem;
}
.edg-token .token-label { font-size: .78rem; letter-spacing: 2px; opacity: .85; text-transform: uppercase; }
.edg-token .token-value {
    font-family: 'Courier New', monospace; font-weight: 700; font-size: clamp(1.2rem, 4vw, 1.7rem); letter-spacing: 4px; margin: .4rem 0;
}
.edg-token .token-units { font-size: .9rem; opacity: .9; }

/* === TOAST === */
.edg-toast-area { position: fixed; top: 90px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.edg-toast {
    background: #fff; border-radius: 14px; box-shadow: var(--edg-shadow-lg); padding: 1rem 1.2rem;
    border-left: 4px solid var(--edg-blue); display: flex; align-items: center; gap: 12px;
    animation: slideIn .35s cubic-bezier(.2,.8,.2,1);
}
.edg-toast.success { border-left-color: var(--edg-green); }
.edg-toast.error { border-left-color: var(--edg-red); }
.edg-toast.warning { border-left-color: var(--edg-amber); }
.edg-toast i { font-size: 1.2rem; }
.edg-toast.success i { color: var(--edg-green); }
.edg-toast.error i { color: var(--edg-red); }
.edg-toast.warning i { color: var(--edg-amber); }
.edg-toast .body { flex: 1; }
.edg-toast .body strong { display: block; font-size: .92rem; }
.edg-toast .body small { color: var(--edg-muted); font-size: .78rem; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* === FOOTER === */
.edg-footer { padding: 1.6rem 0; background: #fff; border-top: 1px solid var(--edg-border); margin-top: auto; }
.edg-pay-icons i { font-size: 1.4rem; color: var(--edg-muted); margin-left: 8px; transition: color .2s; }
.edg-pay-icons i:hover { color: var(--edg-blue); }

/* === UTILITY === */
.edg-divider { height: 1px; background: var(--edg-border); margin: 1.4rem 0; }
.edg-text-mono { font-family: 'Courier New', monospace; }
a {
    text-decoration: none;
}
/* === PRINT === */
@media print {
    .edg-topbar, .edg-footer, .edg-actions, .edg-progress, .edg-wizard-header { display: none !important; }
    .edg-wizard, .edg-receipt { box-shadow: none; border: 0; }
    body { background: #fff; }
}
