/* ============================================================
   HACHETTE CANADA — PORTAIL CLIENT
   Design System · v1.0
   ============================================================ */

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

:root {
  --red:         #E2001A;
  --red-dark:    #b8001a;
  --red-pale:    #fff0f1;
  --black:       #0f0f0f;
  --dark:        #1c1c1c;
  --ink:         #2d2d2d;
  --muted:       #6b6b6b;
  --border:      #e0e0e0;
  --surface:     #f6f6f4;
  --white:       #ffffff;
  --success:     #16a34a;
  --success-bg:  #dcfce7;
  --warning:     #d97706;
  --warning-bg:  #fef3c7;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --info:        #2563eb;
  --info-bg:     #eff6ff;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;

  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.13);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'Courier New', monospace;

  --nav-h: 60px;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font-body); color: var(--ink); background: var(--surface); line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ── UTILITY ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-red { color: var(--red); }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; font-family: var(--font-body);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1.5px solid transparent; transition: all 0.15s;
  white-space: nowrap; border-radius: var(--radius-sm);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); border-color: #ccc; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── FORM ── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--ink); margin-bottom: 6px; letter-spacing: 0.02em; }
.form-input, .form-select {
  width: 100%; padding: 10px 14px;
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); transition: border-color 0.15s, box-shadow 0.15s;
  outline: none; appearance: none;
}
.form-input:focus, .form-select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(226,0,26,0.1); }
.form-input.error { border-color: var(--danger); }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; display: none; }
.form-error.visible { display: block; }
.input-group { position: relative; }
.input-group .form-input { padding-right: 44px; }
.input-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--muted); font-size: 14px; background: none; border: none;
  transition: color 0.15s;
}
.input-suffix:hover { color: var(--ink); }

/* ── BADGE ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; padding: 3px 9px;
  border-radius: 30px; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: #15803d; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-info    { background: var(--info-bg);    color: #1d4ed8; }
.badge-neutral { background: #f0f0f0; color: var(--muted); }
.badge-red     { background: #fde8e8; color: var(--red-dark); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── CARD ── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header { padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; color: var(--dark); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
.data-table thead tr { background: var(--surface); }
.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table .td-isbn { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.data-table .td-title { font-weight: 500; }
.data-table .td-num { text-align: right; font-feature-settings: 'tnum'; }

/* ── KPI CARD ── */
.kpi-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  border-top: 3px solid var(--border);
}
.kpi-card.red { border-top-color: var(--red); }
.kpi-card.green { border-top-color: var(--success); }
.kpi-card.amber { border-top-color: var(--warning); }
.kpi-card.blue { border-top-color: var(--info); }
.kpi-label { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.kpi-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--dark); line-height: 1; }
.kpi-value.red { color: var(--red); }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── ALERT ── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid; font-size: 13px; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 1rem; }
.alert-success { background: var(--success-bg); border-color: #86efac; color: #15803d; }
.alert-danger  { background: var(--danger-bg);  border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: var(--warning-bg); border-color: #fcd34d; color: #92400e; }
.alert-info    { background: var(--info-bg);    border-color: #93c5fd; color: #1e40af; }
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── NAVBAR ── */
.main-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h); background: var(--black);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1rem; border-bottom: 2px solid var(--red);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo { width: 32px; height: 32px; background: var(--red); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 15px; font-weight: 700; color: white; flex-shrink: 0; }
.nav-brand-text { font-size: 14px; font-weight: 600; color: white; letter-spacing: 0.05em; text-transform: uppercase; }
.nav-brand-sub { font-size: 10px; color: rgba(255,255,255,0.4); font-weight: 300; }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-client-badge { background: rgba(226,0,26,0.15); border: 1px solid rgba(226,0,26,0.3); color: #ff6680; padding: 4px 12px; font-size: 11px; font-weight: 500; border-radius: 30px; }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--red); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: white; cursor: pointer; }
.nav-btn-icon { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: color 0.15s; font-size: 18px; }
.nav-btn-icon:hover { color: white; }
.nav-notif { position: relative; }
.nav-notif-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 1.5px solid var(--black); }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: var(--nav-h); left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 100;
  display: flex; flex-direction: column;
}
.sidebar-section { padding: 1.5rem 1rem 0.5rem; }
.sidebar-section-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding: 0 0.5rem; margin-bottom: 4px; }
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; font-size: 13px; font-weight: 400;
  color: var(--muted); border-radius: var(--radius-sm);
  transition: all 0.12s;
}
.sidebar-nav li a:hover { background: var(--surface); color: var(--dark); }
.sidebar-nav li a.active { background: var(--red-pale); color: var(--red); font-weight: 500; }
.sidebar-nav li a .nav-icon { width: 18px; text-align: center; font-size: 14px; }
.sidebar-nav li a .nav-count { margin-left: auto; background: var(--red); color: white; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 30px; }
.sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid var(--border); }
.sidebar-client-info { font-size: 11px; color: var(--muted); }
.sidebar-client-info strong { display: block; font-size: 12px; color: var(--dark); margin-bottom: 2px; }

/* ── MAIN CONTENT ── */
.page-wrap {
  margin-top: var(--nav-h);
  margin-left: var(--sidebar-w);
  padding: 2rem;
  min-height: calc(100vh - var(--nav-h));
}
.page-header { margin-bottom: 1.75rem; }
.page-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.page-breadcrumb { font-size: 12px; color: var(--muted); }
.page-breadcrumb span { color: var(--red); }

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

/* ── STATUS DOT ── */
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.green::before { background: var(--success); }
.status-dot.red::before { background: var(--red); }
.status-dot.amber::before { background: var(--warning); }
.status-dot.gray::before { background: #ccc; }

/* ── TABS ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn { padding: 10px 18px; font-size: 13px; font-weight: 400; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: all 0.12s; }
.tab-btn:hover { color: var(--dark); }
.tab-btn.active { color: var(--red); font-weight: 500; border-bottom-color: var(--red); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── SEARCH ── */
.search-bar { position: relative; }
.search-bar input { padding-left: 38px; }
.search-bar::before { content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; }

/* ── PROGRESS ── */
.progress-wrap { height: 6px; background: var(--border); border-radius: 30px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 30px; background: var(--red); transition: width 0.3s; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 900; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: 90%; max-width: 480px; box-shadow: var(--shadow-lg); transform: translateY(20px); transition: transform 0.2s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 600; color: var(--dark); }
.modal-close { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; padding: 2px 6px; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: flex-end; gap: 8px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state-title { font-size: 16px; font-weight: 500; color: var(--dark); margin-bottom: 6px; }
.empty-state-text { font-size: 13px; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .page-wrap { margin-left: 0; padding: 1rem; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
