/* ═══════════════════════════════════════════════════════════════════════════
   Hapvam — Odoo Pro Style  🔵🟠
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --sidebar-width:  240px;
  --topbar-height:  56px;
  --sidebar-bg:     #1a2332;
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-active: rgba(26,111,219,.25);
  --sidebar-text:   rgba(255,255,255,.65);
  --sidebar-text-h: #ffffff;
  --sidebar-accent: #4a9eff;
  --bg:             #f0f2f5;
  --card-bg:        #ffffff;
  --border:         #e1e5eb;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-secondary: #475569;
  --primary:        #1a6fdb;
  --primary-dark:   #1457b0;
  --primary-bg:     #eff6ff;
  --accent:         #f97316;
  --accent-dark:    #ea6c0a;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --radius:         8px;
  --radius-sm:      5px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow:         0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.1);
  --font:           'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      'Roboto Mono', 'Courier New', monospace;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }

body {
  background:
    linear-gradient(rgba(240,242,245,.96), rgba(240,242,245,.96)),
    url('/static/img/bg.webp?v=2') center/cover fixed;
  background-color: #f0f2f5;
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
body.login-page {
  background:
    linear-gradient(135deg, rgba(26,35,50,.82), rgba(20,87,176,.75)),
    url('/static/img/bg.webp?v=2') center/cover fixed !important;
  display: flex; align-items: center; justify-content: center;
}

#wrapper { position: relative; z-index: 1; min-height: 100vh; }

h1,h2,h3,h4,h5,h6 { font-weight: 600; letter-spacing: -.01em; color: var(--text); }
a { color: var(--primary); transition: color .15s; }
a:hover { color: var(--primary-dark); }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: .5rem; }
.login-logo .bi-display-fill { font-size: 3rem; color: var(--primary); }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
#wrapper { min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  flex-shrink: 0;
  transition: width .22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 2px 0 8px rgba(0,0,0,.12);
}

#sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

#sidebar.collapsed { width: 0; }

.sidebar-brand {
  padding: 1.1rem 1rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
  display: flex;
  align-items: center;
  margin-top: 3px;
}
.sidebar-brand .bi-display-fill { font-size: 1.4rem; color: var(--sidebar-accent); flex-shrink: 0; }
.sidebar-brand h2 { font-size: 1.05rem; margin: 0; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.sidebar-brand small { color: rgba(255,255,255,.4); font-size: .65rem; }

.nav-label {
  font-size: .6rem; font-weight: 700; letter-spacing: .12em;
  color: rgba(255,255,255,.3); padding: .75rem 1rem .25rem;
  text-transform: uppercase; list-style: none;
}

#sidebar .nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .48rem 1rem; border-radius: 6px; margin: 1px 8px;
  color: var(--sidebar-text); font-size: .84rem; font-weight: 400;
  white-space: nowrap; transition: background .14s, color .14s;
  position: relative;
}
#sidebar .nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-h); text-decoration: none; }
#sidebar .nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-accent);
  font-weight: 600;
}
#sidebar .nav-link.active::before {
  content: '';
  position: absolute; left: -8px; top: 4px; bottom: 4px;
  width: 3px; background: var(--primary); border-radius: 0 3px 3px 0;
}
#sidebar .nav-link .bi { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; opacity: .7; }
#sidebar .nav-link.active .bi,
#sidebar .nav-link:hover  .bi { opacity: 1; }

.sidebar-footer {
  padding: .9rem 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}
.avatar-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}

/* ── Topbar ──────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: .9rem; font-weight: 600; color: var(--text); }
.btn-icon {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: .28rem .5rem;
  border-radius: 6px; transition: all .15s; line-height: 1;
}
.btn-icon:hover { background: var(--primary-bg); color: var(--primary); border-color: #bfdbfe; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  font-weight: 600; font-size: .84rem; color: var(--text);
  display: flex; align-items: center;
}

/* ── KPI Cards ────────────────────────────────────────────────────────────────── */
.kpi-card {
  position: relative; border-radius: 10px; padding: 1.25rem 1.4rem;
  display: flex; align-items: center; gap: 1rem;
  overflow: hidden; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }

.kpi-blue   { background: linear-gradient(135deg, #1a6fdb 0%, #1457b0 100%); }
.kpi-indigo { background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%); }
.kpi-green  { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.kpi-amber  { background: linear-gradient(135deg, #f97316 0%, #ea6c0a 100%); }
.kpi-red    { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

.kpi-icon {
  width: 46px; height: 46px; border-radius: 10px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; flex-shrink: 0;
}
.kpi-body  { flex: 1; min-width: 0; }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.kpi-label { font-size: .72rem; opacity: .85; margin-top: 2px; font-weight: 500; }
.kpi-bg-icon {
  position: absolute; right: -8px; bottom: -12px;
  font-size: 5.5rem; opacity: .1; pointer-events: none; line-height: 1;
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.modern-table-wrap,
.card-body .table-responsive { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }

.modern-table,
.table.table-hover {
  width: 100%; border-collapse: collapse;
  font-size: .84rem; font-family: var(--font);
  color: var(--text); margin: 0;
  --bs-table-bg: transparent; --bs-table-hover-bg: transparent;
}
.modern-table thead,
.table.table-hover thead {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}
.modern-table thead th,
.table.table-hover thead th {
  padding: .6rem 1.1rem;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); white-space: nowrap;
  border: none; border-bottom: 2px solid var(--border);
  background: #f8fafc;
}
.modern-table thead th:first-child,
.table.table-hover thead th:first-child { padding-left: 1.25rem; }
.modern-table thead th:last-child,
.table.table-hover thead th:last-child  { padding-right: 1.25rem; text-align: right; }

.modern-table tbody tr,
.table.table-hover tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.modern-table tbody tr:hover,
.table.table-hover tbody tr:hover { background: var(--primary-bg) !important; }

.modern-table tbody td,
.table.table-hover tbody td {
  padding: .75rem 1.1rem; vertical-align: middle;
  color: var(--text); border: none; border-bottom: 1px solid #f1f5f9;
}
.modern-table tbody td:first-child,
.table.table-hover tbody td:first-child { padding-left: 1.25rem; }
.modern-table tbody td:last-child,
.table.table-hover tbody td:last-child  { padding-right: 1.25rem; text-align: right; }

.table > :not(:first-child) { border-top: none; }
.table > thead { --bs-table-bg: #f8fafc; }

.table td a.fw-semibold, .modern-table td a.fw-semibold {
  color: var(--text); font-weight: 600; text-decoration: none; transition: color .12s;
}
.table td a.fw-semibold:hover, .modern-table td a.fw-semibold:hover { color: var(--primary); }

/* ── UID pill ── */
.uid-pill {
  font-family: var(--font-mono); font-size: .72rem;
  background: var(--primary-bg); color: var(--primary-dark);
  padding: .16rem .5rem; border-radius: 4px;
  letter-spacing: .03em; border: 1px solid #bfdbfe;
}
.table td code, .modern-table td code {
  font-family: var(--font-mono); font-size: .75rem;
  background: var(--primary-bg); color: var(--primary-dark);
  padding: .14rem .42rem; border-radius: 4px; border: 1px solid #bfdbfe;
}

/* ── Status badges ─────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: .32rem;
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .68rem; font-weight: 600; letter-spacing: .03em; text-transform: capitalize;
}
.status-badge::before { content:''; width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.status-online  { background: #d1fae5; color: #065f46; }
.status-online::before  { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-offline { background: #f1f5f9; color: #64748b; }
.status-offline::before { background: #94a3b8; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-pending::before { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.status-approved { background: var(--primary-bg); color: var(--primary-dark); }
.status-approved::before { background: var(--primary); }

/* Bootstrap badges */
.badge { font-weight: 500; letter-spacing: .02em; padding: .28em .6em; border-radius: 4px; }
.bg-success  { background: #10b981 !important; }
.bg-danger   { background: #ef4444 !important; }
.bg-warning  { background: #f59e0b !important; color:#fff !important; }
.bg-secondary{ background: #94a3b8 !important; }
.bg-primary  { background: var(--primary) !important; }

.badge-role { font-size:.6rem; padding:.18rem .48rem; border-radius:4px; text-transform:uppercase; letter-spacing:.05em; font-weight:700; }
.badge-admin  { background: var(--primary-bg); color: var(--primary-dark); }
.badge-client { background: #fff7ed; color: #9a3412; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-label { font-size:.78rem; font-weight:600; color:var(--text-secondary); margin-bottom:.3rem; }
.form-control, .form-select {
  background:#fff; border:1px solid var(--border); color:var(--text);
  border-radius:6px; font-size:.84rem; font-family:var(--font);
  padding:.48rem .8rem; transition:border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  background:#fff; border-color:var(--primary); color:var(--text);
  box-shadow:0 0 0 3px rgba(26,111,219,.12); outline:none;
}
.form-control::placeholder { color:#94a3b8; }
.input-group-text { background:#f8fafc; border:1px solid var(--border); color:var(--text-muted); font-size:.84rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn { font-family:var(--font); font-weight:600; letter-spacing:.01em; border-radius:6px; transition:all .15s; }

.btn-primary, .btn-outline-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border:none; color:#fff; box-shadow:0 2px 6px rgba(26,111,219,.3);
}
.btn-primary:hover, .btn-outline-primary:hover {
  background: linear-gradient(135deg, #1563c8 0%, #0f4a9a 100%);
  color:#fff; box-shadow:0 4px 12px rgba(26,111,219,.4);
}
.btn-secondary, .btn-outline-secondary {
  background:#64748b; border:none; color:#fff;
}
.btn-secondary:hover, .btn-outline-secondary:hover { background:#475569; color:#fff; }
.btn-success, .btn-outline-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border:none; color:#fff; box-shadow:0 2px 6px rgba(16,185,129,.3);
}
.btn-success:hover, .btn-outline-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%); color:#fff;
}
.btn-warning, .btn-outline-warning {
  background: linear-gradient(135deg, #f97316 0%, #ea6c0a 100%);
  border:none; color:#fff; box-shadow:0 2px 6px rgba(249,115,22,.3);
}
.btn-warning:hover, .btn-outline-warning:hover {
  background: linear-gradient(135deg, #ea6c0a 0%, #c2570a 100%); color:#fff;
}
.btn-danger, .btn-outline-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border:none; color:#fff; box-shadow:0 2px 6px rgba(239,68,68,.3);
}
.btn-danger:hover, .btn-outline-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color:#fff;
}
.btn-info, .btn-outline-info {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border:none; color:#fff; box-shadow:0 2px 6px rgba(59,130,246,.28);
}
.btn-info:hover, .btn-outline-info:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); color:#fff;
}
.btn-sm  { padding:.28rem .7rem; font-size:.78rem; border-radius:5px; }
.btn-lg  { padding:.6rem 1.4rem; font-size:.95rem; border-radius:8px; }
.btn-icon {
  background:rgba(255,255,255,.8) !important; border:1px solid var(--border) !important;
  color:var(--text-muted); padding:.28rem .5rem; border-radius:6px;
  transition:all .15s; line-height:1; box-shadow:none;
}
.btn-icon:hover { background:var(--primary-bg) !important; color:var(--primary); border-color:#bfdbfe !important; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert { border-radius:var(--radius); font-size:.84rem; font-weight:500; border-width:1px; display:flex; align-items:flex-start; gap:.5rem; }
.alert-success { background:#f0fdf4; color:#065f46; border-color:#bbf7d0; }
.alert-danger  { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.alert-warning { background:#fffbeb; color:#92400e; border-color:#fde68a; }
.alert-info    { background:var(--primary-bg); color:var(--primary-dark); border-color:#bfdbfe; }

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal-content { background:var(--card-bg); border:1px solid var(--border); border-radius:12px; box-shadow:0 25px 60px rgba(0,0,0,.15); }
.modal-header, .modal-footer { border-color:var(--border); }
.modal-header { padding:1.25rem 1.5rem; }
.modal-title  { font-weight:600; font-size:.95rem; }
.modal-body   { padding:1.25rem 1.5rem; }
.modal-footer { padding:1rem 1.5rem; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toastContainer { position:fixed; bottom:1.5rem; right:1.5rem; z-index:9999; display:flex; flex-direction:column; gap:.5rem; }
.hapvam-toast {
  padding:.7rem 1.2rem; border-radius:8px; font-size:.82rem; font-weight:500;
  box-shadow:0 6px 20px rgba(0,0,0,.15);
  animation:slideIn .25s cubic-bezier(.4,0,.2,1);
  display:flex; align-items:center; gap:.5rem;
}
.hapvam-toast.success { background:#10b981; color:#fff; }
.hapvam-toast.danger  { background:#ef4444; color:#fff; }
.hapvam-toast.info    { background:var(--primary); color:#fff; }
@keyframes slideIn { from { transform:translateX(80px); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(26,111,219,.2); border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:rgba(26,111,219,.35); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 13px; }
  #sidebar { position:fixed; top:0; left:0; height:100vh; z-index:1000; transition:transform .22s cubic-bezier(.4,0,.2,1); }
  #sidebar.collapsed { transform:translateX(-100%); width:var(--sidebar-width); }
  #content { width:100%; }
}

main.flex-grow-1 { padding-top: .5rem; }
.p-5.text-center.text-muted i.bi { opacity:.3; color:var(--text-muted); }
