/* ============================================================
   Marketplace Merchant Space — CSS vanilla
   Thème vert pour distinguer de l'admin (bleu foncé)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #f4f6f4;
    --surface:   #ffffff;
    --border:    #e0e6e0;
    --text:      #1a221a;
    --muted:     #5f7360;
    --primary:   #1d6b3a;
    --primary-h: #155230;
    --accent:    #27ae60;
    --success:   #16a34a;
    --warning:   #d97706;
    --danger:    #dc2626;
    --info:      #2563eb;
    --sidebar-w: 230px;
    --radius:    8px;
    --shadow:    0 1px 3px rgba(0,0,0,.07);
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px;
       color: var(--text); background: var(--bg); line-height: 1.5; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); background: var(--primary); color: #c8dfc8;
    display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; height: 100vh; z-index: 100;
}
.sidebar-logo {
    padding: 20px 16px; font-size: 16px; font-weight: 700;
    color: #fff; border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; flex-direction: column; gap: 2px;
}
.sidebar-logo .shop-name {
    font-size: 13px; font-weight: 400; color: rgba(255,255,255,.7);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; color: rgba(255,255,255,.65);
    text-decoration: none; font-size: 13px;
    transition: background .15s, color .15s; position: relative;
}
.sidebar-nav a:hover  { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
    min-width: 20px; text-align: center;
}
.sidebar-footer {
    padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1);
    font-size: 12px; color: rgba(255,255,255,.5);
    display: flex; flex-direction: column; gap: 6px;
}
.btn-logout { color: #fca5a5; text-decoration: none; font-size: 12px; }
.btn-logout:hover { text-decoration: underline; }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.topbar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
}
.page-title { font-size: 18px; font-weight: 600; }
.page-body  { padding: 24px; flex: 1; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 18px; }

/* ---- Stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card.warn    .stat-value { color: var(--warning); }
.stat-card.danger  .stat-value { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.info    .stat-value { color: var(--info); }

/* ---- Tableau ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f0f5f0; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fbf8; }

/* ---- Statuts ---- */
.status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.status-active   { background: #dcfce7; color: #166534; }
.status-inactive { background: #f3f4f6; color: #6b7280; }
.status-pending  { background: #fef9c3; color: #854d0e; }
.status-success  { background: #dcfce7; color: #166534; }
.status-partial  { background: #fef9c3; color: #854d0e; }
.status-error    { background: #fee2e2; color: #991b1b; }
.status-rejected { background: #fee2e2; color: #991b1b; }

/* ---- Stock indicators ---- */
.stock-ok   { color: var(--success); font-weight: 600; }
.stock-low  { color: var(--warning); font-weight: 600; }
.stock-zero { color: var(--danger);  font-weight: 600; }

/* ---- Boutons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: none; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent  { background: var(--accent);  color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost   { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm      { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Formulaires ---- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 13px; font-family: inherit;
    background: var(--surface); color: var(--text); transition: border-color .15s;
}
.combo-wrap { position: relative; }
.combo-input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 13px; font-family: inherit;
    background: var(--surface); color: var(--text); cursor: pointer;
}
.combo-input:focus { cursor: text; }
.combo-panel {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 220px; overflow-y: auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 200;
}
.combo-panel.open { display: block; }
.combo-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.combo-item:hover { background: var(--bg); }
.combo-item.selected { background: var(--primary); color: #fff; }
.combo-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39,174,96,.12); }
textarea { resize: vertical; min-height: 80px; }
.input-inline { width: auto; display: inline-block; }

/* ---- Inline edit ---- */
.editable-field { display: flex; align-items: center; gap: 8px; }
.editable-field input { padding: 4px 8px; font-size: 13px; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- Notification items ---- */
.notif-item { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f0faf0; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-icon.approved { background: #dcfce7; }
.notif-icon.rejected { background: #fee2e2; }
.notif-icon.info     { background: #dbeafe; }
.notif-body { flex: 1; }
.notif-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.notif-msg   { font-size: 13px; color: var(--muted); line-height: 1.5; }
.notif-date  { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---- Modal ---- */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close  { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 6px; margin-top: 16px; align-items: center; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: var(--radius); font-size: 13px; text-decoration: none; border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { background: var(--bg); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .ellipsis { border: none; padding: 6px 4px; color: var(--muted); }

/* ---- Misc ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.flex   { display: flex; align-items: center; gap: 10px; }
.muted  { color: var(--muted); }
.text-sm { font-size: 12px; }
.actions { display: flex; gap: 6px; }
.actions .btn-delete { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--border); }
.product-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.product-thumb-placeholder { width: 40px; height: 40px; background: var(--bg); border-radius: 4px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; text-align: center; color: var(--primary); }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 24px; }

/* ---- Filtres ---- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { width: auto; }
