@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary:       #224032;
  --primary-light: #2d5444;
  --primary-dim:   rgba(34,64,50,0.12);
  --secondary:     #dbe1de;
  --bg:            #f0f3f1;
  --surface:       #ffffff;
  --surface2:      #f4f6f5;
  --border:        #d4dbd7;
  --text:          #1a2e24;
  --text-muted:    #6b8070;
  --success:       #1a7a4a;
  --warning:       #b45309;
  --danger:        #b91c1c;
  --info:          #1d4ed8;
  --purple:        #6d28d9;
  --radius:        12px;
  --transition:    0.18s ease;
  --shadow-sm:     0 1px 3px rgba(34,64,50,0.08);
  --shadow:        0 4px 16px rgba(34,64,50,0.10);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 230px;
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(219,225,222,0.15);
}

.sidebar-logo .brand {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: 1.2px;
}

.sidebar-logo .sub {
  font-size: 10px;
  color: rgba(219,225,222,0.45);
  margin-top: 3px;
}

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

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(219,225,222,0.35);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 12px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 8px;
  color: rgba(219,225,222,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover { background: rgba(219,225,222,0.1); color: var(--secondary); }
.nav-link.active { background: rgba(219,225,222,0.15); color: var(--secondary); border-left: 3px solid var(--secondary); }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 8px;
  border-top: 1px solid rgba(219,225,222,0.15);
}

/* ── MAIN ── */
.main { margin-left: 230px; flex: 1; padding: 28px 30px; min-height: 100vh; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; color: var(--primary); }
.page-title span { color: var(--text-muted); font-weight: 500; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary { background: var(--primary); color: var(--secondary); }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(34,64,50,0.25); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(185,28,28,0.08); color: var(--danger); border: 1px solid rgba(185,28,28,0.2); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-ghost { background: rgba(219,225,222,0.15); color: rgba(219,225,222,0.7); border: none; }
.btn-ghost:hover { background: rgba(219,225,222,0.25); color: var(--secondary); }

/* ── CARDS ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 14px; }

/* ── GRID ── */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── FORM ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }

.form-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
select.form-input { cursor: pointer; }
.form-input::placeholder { color: var(--text-muted); opacity: 0.5; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 10px 14px; text-align: left; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; border-bottom: 2px solid var(--border); white-space: nowrap; background: var(--surface2); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGE ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-pending   { background: rgba(180,83,9,0.1);   color: var(--warning); }
.badge-confirmed { background: rgba(29,78,216,0.1);  color: var(--info); }
.badge-shipped   { background: rgba(109,40,217,0.1); color: var(--purple); }
.badge-delivered { background: rgba(26,122,74,0.1);  color: var(--success); }
.badge-cancelled { background:#fef3c7; color:#92400e;  }
.badge-retour    { background: rgba(185,28,28,0.1);  color: var(--danger); }

/* ── PRODUCT IMAGE ── */
.product-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface2); border: 1px solid var(--border); }
.product-img-placeholder { width: 44px; height: 44px; border-radius: 8px; background: var(--secondary); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--primary); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(34,64,50,0.4); z-index: 999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; backdrop-filter: blur(4px); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto; transform: translateY(14px); transition: transform 0.2s; box-shadow: var(--shadow); }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-family: 'Playfair Display', serif; font-size: 19px; font-weight: 700; color: var(--primary); }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 22px; line-height: 1; transition: color var(--transition); padding: 2px 6px; }
.modal-close:hover { color: var(--text); }

/* ── STAT CARDS ── */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.c1::before { background: var(--primary); }
.stat-card.c2::before { background: var(--success); }
.stat-card.c3::before { background: var(--info); }
.stat-card.c4::before { background: var(--danger); }
.stat-card.c5::before { background: var(--purple); }
.stat-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 7px; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 9px; }
.toast { padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 9px; animation: slideIn 0.25s ease; box-shadow: var(--shadow); }
.toast-success { background: #f0faf4; color: #14532d; border: 1px solid #bbf7d0; }
.toast-error   { background: #fff1f2; color: #9b1c1c; border: 1px solid #fecaca; }
@keyframes slideIn { from { transform: translateX(80px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── ORDER ITEMS ── */
.order-item-row { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.order-item-row .item-grid { display: grid; grid-template-columns: 1fr 70px 100px 100px 30px; gap: 8px; align-items: center; }

.remove-item-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 18px; opacity: 0.6; transition: opacity var(--transition); }
.remove-item-btn:hover { opacity: 1; }

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.price-buy  { color: var(--danger);  font-size: 12px; }
.price-sell { color: var(--success); font-weight: 600; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }

.search-bar { position: relative; }
.search-bar input { padding-left: 34px; }
.search-bar svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 14px; height: 14px; }

.spinner { width: 17px; height: 17px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.55s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.chart-container { position: relative; height: 260px; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.section-label { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--secondary); display: block; }

/* ── MONTHLY TABLE ── */
.monthly-table th { background: var(--primary); color: var(--secondary); }
.monthly-table td.profit-positive { color: var(--success); font-weight: 700; }
.monthly-table td.profit-negative { color: var(--danger); font-weight: 700; }
.monthly-table tr.total-row td { background: var(--surface2); font-weight: 700; border-top: 2px solid var(--primary); }

/* ── LOGIN PAGE ── */
body.login-page { display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-box { background: var(--surface); border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; color: var(--primary); text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-error { background: #fff1f2; color: #9b1c1c; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; display: none; }
