/* ============================================================
   VCOM SaaS Platform — Design System
   Dark #0D1117 + Vert VCOM #8DC63F
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    /* Couleurs VCOM */
    --green:       #8DC63F;
    --green-dark:  #6fa82e;
    --green-light: #a8db5a;
    --green-muted: rgba(141,198,63,.12);
    --green-glow:  rgba(141,198,63,.25);

    /* Dark palette */
    --bg:          #0D1117;
    --bg2:         #161b22;
    --bg3:         #1c2128;
    --border:      rgba(255,255,255,.08);
    --border-hover:rgba(141,198,63,.35);

    /* Textes */
    --text:        #e6edf3;
    --text-muted:  rgba(230,237,243,.55);
    --text-dim:    rgba(230,237,243,.35);

    /* Status */
    --red:         #f85149;
    --orange:      #f0883e;
    --blue:        #58a6ff;
    --purple:      #a371f7;

    /* Typo */
    --font:        'Inter', system-ui, -apple-system, sans-serif;

    /* Layout */
    --sidebar-w:   240px;
    --radius:      10px;
    --radius-sm:   6px;
    --radius-lg:   16px;
    --shadow:      0 4px 24px rgba(0,0,0,.4);
    --shadow-sm:   0 2px 8px rgba(0,0,0,.3);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-light); }
img { max-width: 100%; }

/* ── Layout Admin (back-office) ────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo img { height: 32px; }
.sidebar-logo-text {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--green);
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-section {
    padding: 8px 16px 4px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 450;
    border-radius: 0;
    transition: all .15s;
    position: relative;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.sidebar-link:hover {
    color: var(--text);
    background: rgba(255,255,255,.04);
}
.sidebar-link.active {
    color: var(--green);
    background: var(--green-muted);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--green);
    border-radius: 0 3px 3px 0;
}
.sidebar-link.active svg { opacity: 1; }

.sidebar-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    line-height: 1.5;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-dim);
}

/* ── Main ────────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ── Page content ────────────────────────────────────────── */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: .95rem;
    font-weight: 600;
}

/* ── KPI Stats ───────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--green);
    opacity: .6;
}
.kpi-label {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}
.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.kpi-sub {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.kpi-trend-up   { color: var(--green); }
.kpi-trend-down { color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: var(--green);
    color: #0D1117;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--green-light);
    color: #0D1117;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-muted);
}
.btn-danger {
    background: rgba(248,81,73,.15);
    color: var(--red);
    border: 1px solid rgba(248,81,73,.3);
}
.btn-danger:hover { background: rgba(248,81,73,.25); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
th {
    background: var(--bg3);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── Badges / Status ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-green  { background: rgba(141,198,63,.15); color: var(--green); }
.badge-red    { background: rgba(248,81,73,.15);  color: var(--red); }
.badge-orange { background: rgba(240,136,62,.15); color: var(--orange); }
.badge-blue   { background: rgba(88,166,255,.15); color: var(--blue); }
.badge-purple { background: rgba(163,113,247,.15);color: var(--purple); }
.badge-muted  { background: rgba(255,255,255,.06);color: var(--text-muted); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: .875rem;
    font-family: var(--font);
    transition: border-color .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-muted);
}
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Alert / Flash ───────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: rgba(141,198,63,.12); border: 1px solid rgba(141,198,63,.3); color: var(--green-light); }
.alert-error   { background: rgba(248,81,73,.12);  border: 1px solid rgba(248,81,73,.3);  color: var(--red); }
.alert-warning { background: rgba(240,136,62,.12); border: 1px solid rgba(240,136,62,.3); color: var(--orange); }
.alert-info    { background: rgba(88,166,255,.12); border: 1px solid rgba(88,166,255,.3); color: var(--blue); }

/* ── Boutique — Product Cards ────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all .2s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(141,198,63,.1);
}
.product-card.featured {
    border-color: rgba(141,198,63,.4);
}
.product-card-img {
    height: 180px;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.product-card-cat {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--green);
    margin-bottom: 6px;
}
.product-card-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.product-card-desc {
    font-size: .82rem;
    color: var(--text-muted);
    flex: 1;
    margin-bottom: 14px;
}
.product-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 14px;
}
.price-main {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.price-original {
    font-size: .85rem;
    color: var(--text-dim);
    text-decoration: line-through;
}
.price-period {
    font-size: .75rem;
    color: var(--text-muted);
}

/* ── Pricing / Variants (plan cards) ────────────────────── */
.variants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.variant-card {
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    transition: all .2s;
    cursor: pointer;
}
.variant-card:hover { border-color: var(--green); }
.variant-card.selected {
    border-color: var(--green);
    background: var(--green-muted);
}
.variant-card.highlighted {
    border-color: var(--green);
}
.variant-badge-pop {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: #0D1117;
    font-size: .68rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}
.variant-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.variant-desc {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.variant-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}
.variant-period {
    font-size: .75rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.variant-features { list-style: none; margin: 0; padding: 0; }
.variant-features li {
    font-size: .82rem;
    color: var(--text-muted);
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.variant-features li.included  { color: var(--text); }
.variant-features li.excluded  { opacity: .4; text-decoration: line-through; }
.variant-features li::before   { content: '✓'; color: var(--green); font-weight: 700; }
.variant-features li.excluded::before { content: '✗'; color: var(--text-dim); }

/* ── Checkout ────────────────────────────────────────────── */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}
.checkout-summary {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: sticky;
    top: 24px;
}
.checkout-summary-title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 16px;
}
.checkout-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
.checkout-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    font-size: 1.1rem;
    font-weight: 700;
}

/* Payment method selector */
.payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.payment-method {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
}
.payment-method:hover { border-color: var(--green); color: var(--text); }
.payment-method.selected {
    border-color: var(--green);
    background: var(--green-muted);
    color: var(--text);
}
.payment-method img { height: 20px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ── Espace client (front) ───────────────────────────────── */
.client-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.client-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.client-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
}
.client-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
    width: 100%;
}

/* ── Subscription status cards ───────────────────────────── */
.sub-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.sub-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--green-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sub-card-icon svg { width: 20px; height: 20px; color: var(--green); }
.sub-card-info { flex: 1; }
.sub-card-name { font-weight: 600; margin-bottom: 2px; }
.sub-card-detail { font-size: .8rem; color: var(--text-muted); }
.sub-card-amount { font-size: 1.1rem; font-weight: 700; }
.sub-card.suspended { border-color: rgba(248,81,73,.3); background: rgba(248,81,73,.04); }

/* ── Utilitaires ─────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted  { color: var(--text-muted); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.font-mono   { font-family: monospace; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full      { width: 100%; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg {
    width: 48px; height: 48px;
    opacity: .3;
    margin-bottom: 12px;
}
.empty-state p { font-size: .9rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100%; z-index: 200;
        transform: translateX(-100%); transition: transform .25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
        z-index: 199; backdrop-filter: blur(2px);
    }
    .sidebar-overlay.open { display: block; }
    .main { margin-left: 0; }
    .topbar { padding: 0 12px; }
    .topbar-hamburger { display: flex !important; }
    .topbar-title { font-size: .9rem; }
    .topbar-actions .btn-outline { display: none; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .checkout-grid { grid-template-columns: 1fr; }
    .variants-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 12px; }
    /* Safe area iPhone */
    .page-content { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
