/* بريق - Bariq custom styles */
* { box-sizing: border-box; }
body { direction: rtl; }

/* Owner-customizable primary brand color (Settings > الهوية / العلامة
   التجارية). Set at runtime via document.documentElement.style.setProperty.
   Only the DEFAULT/plain "bariq" token is customizable - -light/-dark/-gold
   stay fixed. !important is needed because the Tailwind Play CDN (loaded
   before this file) generates bg-bariq/text-bariq/border-bariq at a
   comparable specificity with unpredictable injection timing. */
:root { --brand-color: #0f766e; --brand-fg: #ffffff; }
.bg-bariq { background-color: var(--brand-color) !important; }
.text-bariq { color: var(--brand-color) !important; }
.border-bariq { border-color: var(--brand-color) !important; }
/* White text painted on a brand background (chat fab, logo placeholder,
   active filter pills, chat bubbles use "bg-bariq text-white" in markup).
   --brand-fg flips to dark slate on light brand colors so nothing goes
   invisible when the owner picks white. Beats Tailwind's .text-white. */
.bg-bariq.text-white { color: var(--brand-fg) !important; }

.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: .55rem; font-weight: 600; font-size: .875rem; transition: all .15s; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-color); color: var(--brand-fg); }
/* Hover darkens the brand tone itself (via color-mix) rather than jumping
   to a hardcoded teal, so the --brand-fg text stays readable on hover too
   (e.g. white brand -> light-grey hover, still dark text). */
.btn-primary:hover:not(:disabled) { background: #115e59; background: color-mix(in srgb, var(--brand-color) 88%, black); }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover:not(:disabled) { background: #cbd5e1; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-outline { background: white; border: 1px solid #cbd5e1; color: #334155; }
.btn-outline:hover:not(:disabled) { background: #f1f5f9; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

.input, select.input, textarea.input {
  width: 100%; padding: .6rem .85rem; border: 1px solid #cbd5e1; border-radius: .5rem;
  font-size: .9rem; background: white; color: #1e293b; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--brand-color); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
.input.error { border-color: #dc2626; }

/* Chat input (public/static/js/views/chatbot.js) - contenteditable rather
   than a plain <input> so the "/اعمل" shortcut can render as a real inline
   tag chip; dir="auto" on the element itself handles RTL/LTR switching. */
.chat-input-editable {
  min-height: 2.5rem;
  max-height: 8rem;
  overflow-y: auto;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-input-editable:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}
.chat-tag {
  display: inline-flex;
  align-items: center;
  background: var(--brand-color);
  color: var(--brand-fg);
  border-radius: .4rem;
  padding: .1rem .55rem;
  font-size: .78rem;
  font-weight: 700;
  margin: 0 .3rem;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
}
/* Chat borders follow the owner-customizable brand color (Settings > الهوية).
   All chat chrome (card, bubbles, suggestions, input) uses --brand-color so a
   rebrand re-themes the chat with no markup changes. */
.chat-card { border-color: var(--brand-color) !important; }
.chat-bubble-user { border: 1px solid var(--brand-color) !important; }
.chat-bubble-bot { border: 1px solid var(--brand-color) !important; }
.chat-suggestion-btn { border: 1px solid var(--brand-color) !important; }
.chat-input-editable { border-color: var(--brand-color) !important; }
.chat-input-editable:focus { border-color: var(--brand-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color) 15%, transparent); }

.label { display: block; font-size: .82rem; font-weight: 600; color: #475569; margin-bottom: .3rem; }
.hint { font-size: .75rem; color: #94a3b8; margin-top: .2rem; }
.error-text { font-size: .78rem; color: #dc2626; margin-top: .25rem; }

.card { background: white; border-radius: .85rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); border: 1px solid #eef2f4; }

.badge { display: inline-flex; align-items: center; padding: .15rem .6rem; border-radius: 9999px; font-size: .72rem; font-weight: 700; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1e40af; }

table.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.data-table th { text-align: right; padding: .6rem .8rem; background: #f8fafc; color: #64748b; font-weight: 700; font-size: .78rem; border-bottom: 1px solid #e2e8f0; }
table.data-table td { padding: .6rem .8rem; border-bottom: 1px solid #f1f5f9; }
table.data-table tbody tr:hover { background: #f8fafc; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-box { background: white; border-radius: 1rem; width: 100%; max-height: 90vh; overflow-y: auto; }

.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 200; padding: .75rem 1.5rem; border-radius: .6rem; font-weight: 600; font-size: .9rem; box-shadow: 0 4px 14px rgba(0,0,0,.15); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Owner-customizable sidebar background (Settings > الهوية / العلامة
   التجارية). --sidebar-fg/-fg-dim/-border/-hover-bg are computed at runtime
   (public/static/js/lib/brand.js) from --sidebar-bg's brightness, so text
   stays readable whatever background color is picked. Defaults below match
   the original hardcoded dark theme (Tailwind slate-900). */
:root {
  --sidebar-bg: #0f172a;
  --sidebar-fg: #ffffff;
  --sidebar-fg-dim: #94a3b8;
  --sidebar-border: rgba(255,255,255,.1);
  --sidebar-hover-bg: rgba(255,255,255,.08);
}
#sidebar, #mobile-topbar { background: var(--sidebar-bg); }
.sidebar-fg { color: var(--sidebar-fg); }
.sidebar-fg-dim { color: var(--sidebar-fg-dim); }
.sidebar-border { border-color: var(--sidebar-border); }
.sidebar-active-overlay:hover, .sidebar-active-overlay:active { background: var(--sidebar-hover-bg); }

.sidebar-link { display: flex; align-items: center; gap: .7rem; padding: .65rem .9rem; border-radius: .55rem; color: var(--sidebar-fg-dim); font-size: .875rem; font-weight: 600; transition: all .15s; cursor: pointer; }
.sidebar-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-fg); }
.sidebar-link.active { background: var(--brand-color); color: var(--brand-fg); }

.pos-product-card { cursor: pointer; transition: all .12s; }
.pos-product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.08); border-color: var(--brand-color); }

@media print { .no-print { display: none !important; } }

/* ===== Mobile responsive layout ===== */
@media (max-width: 767px) {
  #sidebar {
    position: fixed;
    top: 0; bottom: 0; right: 0;
    z-index: 50;
    width: 260px;
    max-width: 80vw;
    transform: translateX(100%);
    transition: transform .22s ease;
  }
  #sidebar.sidebar-open { transform: translateX(0); }
  #main-content { padding-top: 3.25rem; }
}
