/* Aber Express — Odoo-style UI, RTL/LTR aware */
:root {
  --topbar-bg: #1f2937;
  --topbar-fg: #e5e7eb;
  --accent: #714b67;
  --accent-2: #00a09d;
  --bg: #f0f1f5;
  --panel: #ffffff;
  --border: #dee2e8;
  --text: #212529;
  --muted: #6b7280;
  --danger: #dc3545;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Topbar ---------------- */
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  max-width: 1600px;
  margin: 0 auto;
}
.brand {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: #fff; }
.brand-badge {
  background: var(--accent);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.main-menu { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.menu-item {
  color: var(--topbar-fg);
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 13.5px;
}
.menu-item:hover { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }
.menu-item.active { background: var(--accent); color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.lang-toggle {
  color: #fff; border: 1px solid rgba(255,255,255,.35);
  padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 12.5px;
}
.lang-toggle:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* bell */
.bell-wrap, .user-menu-wrap { position: relative; }
.bell-btn {
  background: none; border: none; color: var(--topbar-fg);
  font-size: 17px; cursor: pointer; position: relative; padding: 4px 6px;
}
.bell-count {
  position: absolute; top: -4px; inset-inline-end: -4px;
  background: var(--danger); color: #fff; border-radius: 10px;
  font-size: 10px; padding: 1px 5px; font-weight: 700;
}
.bell-dropdown, .user-dropdown {
  position: absolute; inset-inline-end: 0; top: 40px;
  background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  min-width: 300px; z-index: 300;
}
.bell-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.bell-list { max-height: 340px; overflow-y: auto; }
.bell-item { padding: 10px 14px; border-bottom: 1px solid #f1f2f6; display: block; color: var(--text); }
.bell-item.unread { background: #eef4ff; }
.bell-item small { color: var(--muted); display: block; }
.bell-empty { padding: 18px; text-align: center; color: var(--muted); }
.user-btn {
  background: none; border: none; color: var(--topbar-fg);
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-2); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-dropdown { min-width: 200px; padding: 8px 0; }
.user-dropdown a { display: block; padding: 8px 16px; color: var(--text); }
.user-dropdown a:hover { background: #f3f4f8; text-decoration: none; }
.user-info { padding: 8px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.role-badge { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ---------------- Content ---------------- */
.content { max-width: 1600px; margin: 0 auto; padding: 18px 16px 60px; }
.page-title { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-title h1 { font-size: 22px; margin: 0; font-weight: 700; }
.page-title .spacer { flex: 1; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); }
.flash-success { background: #e8f9ee; border-inline-start: 4px solid var(--success); }
.flash-error { background: #fdecec; border-inline-start: 4px solid var(--danger); }
.flash-info { background: #eaf2fe; border-inline-start: 4px solid var(--info); }

/* ---------------- Panels / cards ---------------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-body { padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
  border-inline-start: 4px solid var(--accent);
}
.stat-card .stat-value { font-size: 24px; font-weight: 800; }
.stat-card .stat-label { color: var(--muted); font-size: 12.5px; }
.stat-card.green { border-inline-start-color: var(--success); }
.stat-card.blue { border-inline-start-color: var(--info); }
.stat-card.orange { border-inline-start-color: var(--warning); }
.stat-card.red { border-inline-start-color: var(--danger); }
.stat-card.teal { border-inline-start-color: var(--accent-2); }

/* ---------------- Control panel (Odoo) ---------------- */
.control-panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.control-panel .search-box { position: relative; flex: 1; min-width: 220px; max-width: 460px; }
.search-box input {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 13.5px; background: #fafbfc;
}
[dir="rtl"] .search-box input { padding: 8px 34px 8px 12px; }
.search-box::before {
  content: "🔍"; position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); font-size: 13px; opacity: .6;
}
.cp-group { position: relative; }
.cp-btn {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--text);
}
.cp-btn:hover { background: #f3f4f8; }
.cp-btn.star.active { color: var(--warning); border-color: var(--warning); }
.cp-menu {
  position: absolute; top: 38px; inset-inline-start: 0; z-index: 150;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 240px; padding: 10px; display: none;
}
.cp-menu.open { display: block; }
.cp-menu .cp-menu-title { font-size: 11.5px; color: var(--muted); text-transform: uppercase; margin: 6px 4px 4px; }
.cp-menu label { display: flex; gap: 8px; align-items: center; padding: 4px; font-size: 13px; cursor: pointer; }
.cp-menu select, .cp-menu input[type="date"], .cp-menu input[type="text"] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; margin: 3px 0; font-size: 13px;
}
.cp-menu .fav-item { display: flex; justify-content: space-between; align-items: center; padding: 4px; border-radius: 5px; cursor: pointer; }
.cp-menu .fav-item:hover { background: #f3f4f8; }
.cp-menu .fav-del { color: var(--danger); cursor: pointer; padding: 0 6px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; border: 1px solid transparent;
  font-size: 13.5px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5d3d55; text-decoration: none; color: #fff; }
.btn-secondary { background: var(--accent-2); color: #fff; }
.btn-secondary:hover { text-decoration: none; color: #fff; opacity: .92; }
.btn-light { background: #fff; border-color: var(--border); color: var(--text); }
.btn-light:hover { background: #f3f4f8; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------- List view ---------------- */
.list-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: start; padding: 10px 12px; background: #f8f9fb;
  border-bottom: 2px solid var(--border); font-weight: 700; white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.list th .sort-arrow { font-size: 10px; color: var(--accent); }
table.list td { padding: 9px 12px; border-bottom: 1px solid #f0f1f5; white-space: nowrap; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #f6f4f8; }
table.list tbody tr.group-row { background: #eceaf1; font-weight: 700; cursor: default; }
table.list .cell-muted { color: var(--muted); }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.badge-soft { background: #eef0f4; color: var(--text); }
.list-footer { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.list-footer .count { color: var(--muted); font-size: 12.5px; }
.pager { display: flex; gap: 4px; margin-inline-start: auto; }
.pager a, .pager span {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font-size: 12.5px; background: #fff;
}
.pager a.active, .pager a:hover { background: var(--accent); color: #fff; text-decoration: none; border-color: var(--accent); }
.pager .pager-dots { border: none; background: none; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: #374151; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13.5px; background: #fff; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(113, 75, 103, .25); border-color: var(--accent);
}
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.field input[readonly] { background: #f6f7f9; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.required-star { color: var(--danger); }

/* ---------------- Timeline ---------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 18px 26px; border-inline-start: none;
}
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: 7px; top: 18px; bottom: -2px;
  width: 2px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  position: absolute; inset-inline-start: 0; top: 4px;
  width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}
.timeline .tl-body { padding-inline-start: 8px; }
.timeline .tl-title { font-weight: 700; }
.timeline .tl-meta { color: var(--muted); font-size: 12px; }

/* ---------------- Detail cards ---------------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; row-gap: 7px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #111827; color: #fff; padding: 11px 16px; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 13.5px; max-width: 340px;
  animation: toast-in .25s ease-out; border-inline-start: 4px solid var(--info);
}
.toast.success { border-inline-start-color: var(--success); }
.toast.error { border-inline-start-color: var(--danger); }
.toast.warning { border-inline-start-color: var(--warning); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- Confirm modal ---------------- */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; z-index: 998;
}
.confirm-box { background: #fff; border-radius: 10px; padding: 22px; width: 360px; max-width: 92vw; box-shadow: 0 14px 40px rgba(0,0,0,.3); }
.confirm-msg { font-size: 14.5px; margin-bottom: 18px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- Modal (generic, import preview) ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .5);
  display: flex; align-items: center; justify-content: center; z-index: 997;
}
.modal-box { background: #fff; border-radius: 10px; padding: 20px; width: 760px; max-width: 94vw; max-height: 84vh; overflow: auto; }
.modal-box h3 { margin-top: 0; }

/* ---------------- POD gallery ---------------- */
.pod-gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.pod-item { border: 1px solid var(--border); border-radius: 8px; padding: 8px; width: 140px; text-align: center; font-size: 12px; }
.pod-item img { max-width: 100%; height: 90px; object-fit: cover; border-radius: 6px; }
.pod-item .pod-type { color: var(--muted); }

/* ---------------- Login ---------------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1f2937, #714b67); }
.login-card { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.35); padding: 34px; width: 380px; max-width: 92vw; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand .brand-badge { width: 46px; height: 46px; font-size: 24px; }
.login-error { background: #fdecec; color: var(--danger); padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.login-lang { text-align: center; margin-top: 16px; }

/* ---------------- Charts ---------------- */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.chart-box h3 { margin: 0 0 12px; font-size: 15px; }
.chart-box canvas { max-height: 300px; }

/* ---------------- Report ---------------- */
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.report-table th, .report-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: start; }
.report-table th { background: #f3f4f8; }
.report-table tfoot td { font-weight: 800; background: #fafbfc; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .main-menu { display: none; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .main-menu { order: 3; width: 100%; display: flex; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (max-width: 640px) {
  .user-name { display: none; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------------- Print ---------------- */
@media print {
  .topbar, .control-panel, .form-actions, .btn, .toast-wrap, .confirm-overlay, .no-print, .list-footer { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .panel, .list-wrap, .chart-box, .stat-card { box-shadow: none; border: 1px solid #ccc; }
  table.list tbody tr { cursor: default; }
  a { color: inherit; text-decoration: none; }
}

/* hidden attribute must win over display:flex */
.confirm-overlay[hidden] { display: none !important; }

/* Global: the hidden attribute must always win (modals, dropdowns, overlays) */
[hidden] { display: none !important; }

/* Inline grid editing */
.cell-edit { cursor: text; }
.cell-edit:hover { background: rgba(37,99,235,.08); outline: 1px dashed rgba(37,99,235,.45); outline-offset: -1px; }
.cell-editor { width: 100%; border: 1px solid #2563eb; border-radius: 6px; padding: 4px 6px; font: inherit; background: #fff; }
.order-link { color: inherit; text-decoration: none; }
.order-link:hover { color: var(--accent-2); text-decoration: underline; }
.view-link { text-decoration: none; margin-inline-start: 6px; font-size: 13px; opacity: .7; }
.view-link:hover { opacity: 1; }
