/* ============================================================
   HR WEB PORTAL  — Feuille de style principale
   Portail RH Odoo 18  —  Bootstrap 5 requis
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --hrp-primary:       #1e3a5f;
  --hrp-primary-dark:  #152c48;
  --hrp-primary-light: #2a5298;
  --hrp-accent:        #3498db;
  --hrp-sidebar-w:     270px;
  --hrp-topbar-h:      60px;
  --hrp-bg:            #f0f3f8;
  --hrp-card-bg:       #ffffff;
  --hrp-text:          #2d3748;
  --hrp-text-muted:    #718096;
  --hrp-border:        #e2e8f0;
  --hrp-shadow:        0 2px 12px rgba(0,0,0,.08);
  --hrp-radius:        10px;
  --hrp-sidebar-text:  rgba(255,255,255,.85);
  --hrp-transition:    .22s ease;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.hrp-body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--hrp-bg);
  color: var(--hrp-text);
  min-height: 100vh;
}

/* ── Auth pages ────────────────────────────────────────────── */
.hrp-auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--hrp-primary) 0%, var(--hrp-primary-light) 100%);
  padding: 1rem;
}

.hrp-auth-card {
  background: var(--hrp-card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
}

.hrp-auth-header { text-align: center; margin-bottom: 2rem; }

.hrp-auth-icon {
  font-size: 3rem;
  color: var(--hrp-primary);
  display: block;
  margin-bottom: .75rem;
}

.hrp-auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--hrp-primary);
  margin: 0 0 .25rem;
}

.hrp-auth-subtitle {
  color: var(--hrp-text-muted);
  font-size: .92rem;
  margin: 0;
}

.hrp-auth-form .form-label { font-weight: 600; font-size: .88rem; color: var(--hrp-text); }

.hrp-link { color: var(--hrp-primary); font-weight: 600; text-decoration: none; }
.hrp-link:hover { color: var(--hrp-primary-light); text-decoration: underline; }

/* ── Wrapper layout ────────────────────────────────────────── */
.hrp-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.hrp-sidebar {
  width: var(--hrp-sidebar-w);
  min-height: 100vh;
  background: var(--hrp-primary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  transition: transform var(--hrp-transition);
  overflow-y: auto;
}

.hrp-sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.4rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.12);
  letter-spacing: .02em;
}

.hrp-emp-block {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.hrp-emp-avatar {
  font-size: 3.5rem;
  color: rgba(255,255,255,.6);
  margin-bottom: .5rem;
  line-height: 1;
}

.hrp-emp-name {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  line-height: 1.3;
}

.hrp-emp-job {
  font-size: .8rem;
  color: rgba(255,255,255,.6);
  margin-top: .2rem;
}

.hrp-emp-dept {
  font-size: .75rem;
  color: rgba(255,255,255,.45);
  margin-top: .1rem;
}

/* Navigation */
.hrp-nav { padding: .75rem 0; flex: 1; margin: 0; }

.hrp-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1.5rem;
  color: var(--hrp-sidebar-text);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--hrp-transition), color var(--hrp-transition);
  border-left: 3px solid transparent;
}

.hrp-nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  border-left-color: rgba(255,255,255,.4);
}

.hrp-nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}

.hrp-nav-link .fa { width: 18px; text-align: center; font-size: 1rem; }

.hrp-nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  padding: .3em .55em;
  border-radius: 99px;
}

/* Sidebar footer */
.hrp-sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

.hrp-logout {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem 1rem;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .88rem;
  transition: background var(--hrp-transition), color var(--hrp-transition);
}

.hrp-logout:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

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

/* Top bar */
.hrp-topbar {
  height: var(--hrp-topbar-h);
  background: var(--hrp-card-bg);
  border-bottom: 1px solid var(--hrp-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  position: sticky;
  top: 0;
  z-index: 100;
}

.hrp-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.hrp-user-pill {
  font-size: .88rem;
  color: var(--hrp-text-muted);
  font-weight: 500;
}

.hrp-btn-logout {
  background: none;
  border: 1px solid var(--hrp-border);
  color: var(--hrp-text-muted);
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .9rem;
  line-height: 1;
}
.hrp-btn-logout:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* Toggle button (mobile) */
.hrp-toggle {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--hrp-text);
  padding: 0;
  cursor: pointer;
  margin-right: 1rem;
}

/* Page content */
.hrp-content { padding: 1.75rem 1.5rem; flex: 1; }

/* ── Page header ───────────────────────────────────────────── */
.hrp-page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hrp-border);
}

.hrp-page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--hrp-primary);
  margin: 0 0 .15rem;
}

.hrp-page-subtitle {
  font-size: .9rem;
  color: var(--hrp-text-muted);
}

/* ── Sections ──────────────────────────────────────────────── */
.hrp-section {
  background: var(--hrp-card-bg);
  border-radius: var(--hrp-radius);
  box-shadow: var(--hrp-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.hrp-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--hrp-primary);
  margin: 0 0 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--hrp-bg);
}

/* ── Info cards (dashboard) ────────────────────────────────── */
.hrp-info-card {
  background: var(--hrp-card-bg);
  border-radius: var(--hrp-radius);
  box-shadow: var(--hrp-shadow);
  padding: 1.2rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--hrp-border);
  transition: transform var(--hrp-transition), box-shadow var(--hrp-transition);
}

.hrp-info-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); }
.hrp-info-card.hrp-clickable { cursor: pointer; }

.hrp-info-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.hrp-info-label { font-size: .78rem; color: var(--hrp-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.hrp-info-value { font-size: .97rem; font-weight: 600; color: var(--hrp-text); margin-top: .15rem; }

/* Soft bg colors */
.bg-primary-soft   { background: #dbeafe; }
.bg-success-soft   { background: #dcfce7; }
.bg-info-soft      { background: #e0f2fe; }
.bg-warning-soft   { background: #fef9c3; }
.bg-danger-soft    { background: #fee2e2; }
.bg-secondary-soft { background: #f1f5f9; }

/* ── Leave balance cards ────────────────────────────────────── */
.hrp-leave-balance-card.hrp-lb-warning {
  border-color: #fca5a5;
  background: #fff5f5;
}
.hrp-lb-footer { min-height: 1.3em; }

.hrp-leave-balance-card {
  background: var(--hrp-card-bg);
  border: 1px solid var(--hrp-border);
  border-radius: var(--hrp-radius);
  padding: 1.1rem;
  box-shadow: var(--hrp-shadow);
}

.hrp-lb-name {
  font-size: .82rem;
  font-weight: 700;
  color: var(--hrp-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hrp-lb-numbers { display: flex; gap: 1rem; }

.hrp-lb-item { text-align: center; flex: 1; }
.hrp-lb-num  { display: block; font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
.hrp-lb-lbl  { display: block; font-size: .72rem; color: var(--hrp-text-muted); margin-top: .1rem; }
.hrp-lb-progress { border-radius: 99px; background: #f1f5f9; }

/* Balance mini (congés page) */
.hrp-balance-mini {
  background: var(--hrp-card-bg);
  border: 1px solid var(--hrp-border);
  border-radius: 8px;
  padding: .8rem;
  text-align: center;
}
.hrp-bm-name { font-size: .75rem; font-weight: 600; color: var(--hrp-text-muted); margin-bottom: .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrp-bm-val  { font-size: 1.6rem; font-weight: 700; color: var(--hrp-primary); line-height: 1; }
.hrp-bm-unit { font-size: .9rem; font-weight: 500; }
.hrp-bm-sub  { font-size: .72rem; color: var(--hrp-text-muted); margin-top: .15rem; }

/* ── Tables ────────────────────────────────────────────────── */
.hrp-table {
  font-size: .88rem;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.hrp-table thead th {
  background: var(--hrp-bg);
  color: var(--hrp-text-muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--hrp-border);
  padding: .75rem 1rem;
  white-space: nowrap;
}

.hrp-table tbody td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--hrp-border);
  vertical-align: middle;
  color: var(--hrp-text);
}

.hrp-table tbody tr:last-child td { border-bottom: none; }
.hrp-table tbody tr:hover { background: #f8fafc; }

/* ── Badges ────────────────────────────────────────────────── */
.hrp-badge-secondary { background: #94a3b8; color: #fff; padding: .3em .65em; border-radius: 99px; font-size: .78em; font-weight: 600; }
.hrp-badge-warning   { background: #f59e0b; color: #fff; padding: .3em .65em; border-radius: 99px; font-size: .78em; font-weight: 600; }
.hrp-badge-info      { background: #0ea5e9; color: #fff; padding: .3em .65em; border-radius: 99px; font-size: .78em; font-weight: 600; }
.hrp-badge-success   { background: #22c55e; color: #fff; padding: .3em .65em; border-radius: 99px; font-size: .78em; font-weight: 600; }
.hrp-badge-danger    { background: #ef4444; color: #fff; padding: .3em .65em; border-radius: 99px; font-size: .78em; font-weight: 600; }

/* ── Filter bar ────────────────────────────────────────────── */
.hrp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.hrp-filter-btn {
  display: inline-block;
  padding: .35rem .9rem;
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--hrp-card-bg);
  color: var(--hrp-text-muted);
  border: 1px solid var(--hrp-border);
  transition: all var(--hrp-transition);
}

.hrp-filter-btn:hover { background: var(--hrp-bg); color: var(--hrp-text); }
.hrp-filter-btn.active { background: var(--hrp-primary); color: #fff; border-color: var(--hrp-primary); }

/* ── Forms ────────────────────────────────────────────────────*/
.hrp-form .form-label { font-weight: 600; font-size: .88rem; }
.hrp-form .form-label.required::after { content: ' *'; color: #ef4444; }
.hrp-form-actions { display: flex; align-items: center; }

/* ── Buttons ───────────────────────────────────────────────── */
.hrp-btn-primary {
  background: var(--hrp-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: .5rem 1.2rem;
  transition: background var(--hrp-transition), transform .1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.hrp-btn-primary:hover {
  background: var(--hrp-primary-dark);
  color: #fff;
  transform: translateY(-1px);
}

.hrp-btn-primary:active { transform: translateY(0); }

/* ── Payslip preview ───────────────────────────────────────── */
.hrp-payslip-preview {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--hrp-radius);
  padding: 1.25rem 1.5rem;
}

.hrp-payslip-name { font-size: 1.05rem; font-weight: 700; color: var(--hrp-primary); }
.hrp-payslip-period { font-size: .88rem; color: var(--hrp-text-muted); margin-top: .25rem; }
.hrp-payslip-net { font-size: 1.1rem; color: var(--hrp-text); margin-top: .5rem; }

/* ── Chat d'échanges (tickets) ─────────────────────────────── */
.hrp-chat {
  border: 1px solid var(--hrp-border);
  border-radius: var(--hrp-radius);
  overflow: hidden;
  background: #fff;
}

.hrp-chat-messages {
  max-height: 460px;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  background: #eef2f7;
}

.hrp-chat-empty {
  text-align: center;
  color: var(--hrp-text-muted);
  padding: 1.5rem 0;
}

.hrp-chat-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
}

.hrp-chat-row-me { flex-direction: row-reverse; }

.hrp-chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .74rem;
  font-weight: 700;
  color: #fff;
  background: var(--hrp-accent);
}

.hrp-chat-row-me .hrp-chat-avatar { background: var(--hrp-primary); }

.hrp-chat-bubble {
  max-width: 72%;
  padding: .55rem .85rem;
  border-radius: 16px;
  font-size: .89rem;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  word-wrap: break-word;
}

.hrp-chat-row-other .hrp-chat-bubble {
  background: #fff;
  color: var(--hrp-text);
  border: 1px solid var(--hrp-border);
  border-bottom-left-radius: 4px;
}

.hrp-chat-row-me .hrp-chat-bubble {
  background: var(--hrp-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.hrp-chat-bubble-meta {
  font-size: .7rem;
  font-weight: 600;
  margin-bottom: .2rem;
  opacity: .75;
  display: flex;
  gap: .4rem;
}

.hrp-chat-row-me .hrp-chat-bubble-meta { color: rgba(255,255,255,.85); }
.hrp-chat-row-other .hrp-chat-bubble-meta { color: var(--hrp-text-muted); }

.hrp-chat-bubble-body :last-child { margin-bottom: 0; }

.hrp-chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  padding: .75rem;
  background: #fff;
  border-top: 1px solid var(--hrp-border);
}

.hrp-chat-input-bar textarea {
  resize: none;
  flex: 1;
}

.hrp-chat-send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hrp-row-clickable:hover { background: #f8fafc; }

/* ── Empty state ───────────────────────────────────────────── */
.hrp-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--hrp-text-muted);
}

/* ── Mobile overlay ────────────────────────────────────────── */
.hrp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
}
.hrp-overlay.show { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Tablette / Mobile ─────────────────────────────────────── */
@media (max-width: 767.98px) {
  .hrp-sidebar {
    transform: translateX(calc(-1 * var(--hrp-sidebar-w)));
  }

  .hrp-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,.3);
  }

  .hrp-main { margin-left: 0; }

  .hrp-content { padding: 1rem; }

  .hrp-page-title { font-size: 1.2rem; }

  .hrp-auth-card { padding: 2rem 1.25rem; }

  .hrp-table { font-size: .82rem; }
  .hrp-table thead th,
  .hrp-table tbody td { padding: .6rem .7rem; }
}

/* ── Très petits écrans ────────────────────────────────────── */
@media (max-width: 480px) {
  .hrp-lb-numbers { gap: .5rem; }
  .hrp-lb-num { font-size: 1.1rem; }
  .hrp-form-actions { flex-direction: column; gap: .5rem; align-items: stretch; }
  .hrp-form-actions .btn { width: 100%; justify-content: center; }
}
