/* webfont @import removed: the families are self-hosted in css/webfonts.css, which the
   templates link directly. An @import here was strictly worse than a <link> -- the browser
   had to fetch and parse this file before it could even start the font request. */

html[dir="rtl"] body,
html[dir="rtl"] .fw-medium,
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3,
html[dir="rtl"] h4, html[dir="rtl"] h5, html[dir="rtl"] h6,
html[dir="rtl"] .btn, html[dir="rtl"] .form-control, html[dir="rtl"] .form-select,
html[dir="rtl"] .dropdown-menu, html[dir="rtl"] .table {
  font-family: "Tajawal", "Outfit", sans-serif !important;
}

html[dir="rtl"] body { letter-spacing: 0; }
html[dir="rtl"] .text-uppercase { text-transform: none !important; }

/* Folder tree */
.folder-tree ul { list-style: none; padding-inline-start: 1rem; margin: 0; }
.folder-tree li { padding: 2px 0; }
.folder-tree a { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; }
.folder-tree a:hover, .folder-tree a.active { background: var(--bs-primary-bg-subtle, #f1f2fd); color: var(--bs-primary, #0f79f3); }
.folder-tree .ri-folder-fill, .folder-tree .ri-folder-open-fill { color: #ffb264; }

/* Document cards */
.doc-icon { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; }
.doc-icon.pdf { background: #fdebf3; color: #e74c3c; }
.doc-icon.img { background: #eafbf2; color: #2ed47e; }
.doc-icon.office { background: #e7effd; color: #0f79f3; }
.doc-icon.other { background: #f4f6fc; color: #475569; }

/* Drop zone */
.dropzone { border: 2px dashed #c2cada; border-radius: 12px; padding: 40px; text-align: center; cursor: pointer; transition: all .2s; }
.dropzone.dragover, .dropzone:hover { border-color: #0f79f3; background: #f1f2fd; }

/* Viewer */
.viewer-frame { width: 100%; height: calc(100vh - 220px); border: 0; border-radius: 10px; background: #f4f6fc; }

/* Audit */
.hash-mono { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; }

/* Toasts */
.toast-container { z-index: 2000; }

.badge-soft-success { background: #eafbf2; color: #0EAC5D; }
.badge-soft-danger { background: #fdebf3; color: #e74c3c; }
.badge-soft-warning { background: #fff4e5; color: #FC7013; }
.badge-soft-info { background: #e7effd; color: #0f79f3; }
.badge-soft-secondary { background: #f4f6fc; color: #475569; }

.preloader { display: none !important; }

/* =====================================================================
   UI ENHANCEMENTS — applied to every page (base.html + login.html both
   load this file). Theme-aware: honours Fila's body[data-theme="dark"].
   ===================================================================== */
:root {
  --edrms-radius: 16px;
  --edrms-radius-sm: 10px;
  --edrms-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --edrms-shadow-hover: 0 10px 30px rgba(16, 24, 40, .12);
  --edrms-ring: 0 0 0 3px rgba(var(--bs-primary-rgb), .18);
  --edrms-hairline: var(--bs-border-color, #e7e2e2);
  --edrms-tint: rgba(var(--bs-primary-rgb), .08);
  --edrms-tint-strong: rgba(var(--bs-primary-rgb), .12);
}
body[data-theme="dark"] {
  --edrms-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .40);
  --edrms-shadow-hover: 0 12px 32px rgba(0, 0, 0, .55);
  --edrms-hairline: rgba(255, 255, 255, .09);
  --edrms-tint: rgba(var(--bs-primary-rgb), .16);
  --edrms-tint-strong: rgba(var(--bs-primary-rgb), .24);
}

/* Subtle branded background wash */
body.bg-body-bg {
  background-image: radial-gradient(1100px 460px at 100% -8%, rgba(var(--bs-primary-rgb), .07), transparent 62%);
  background-attachment: fixed;
}
body[data-theme="dark"].bg-body-bg {
  background-image: radial-gradient(1100px 460px at 100% -8%, rgba(var(--bs-primary-rgb), .14), transparent 62%);
}

/* ---- Cards ---- */
.card {
  border-radius: var(--edrms-radius) !important;
  border: 1px solid var(--edrms-hairline) !important;
  box-shadow: var(--edrms-shadow);
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
}
.card:hover { box-shadow: var(--edrms-shadow-hover); }
/* don't let the hover shadow feel jumpy on big static dashboard cards */
.card .card, .no-lift { box-shadow: var(--edrms-shadow) !important; }

/* ---- Header: sticky, elevated ---- */
.header-area {
  position: sticky; top: 0; z-index: 1020;
  box-shadow: var(--edrms-shadow);
  border: 1px solid var(--edrms-hairline) !important;
  border-radius: var(--edrms-radius) !important;
}
.header-area .src-form .form-control {
  border-radius: 999px; background: var(--bs-tertiary-bg, #f8f9fa);
  border-color: transparent; padding-inline-start: 16px;
}
.header-area .src-form .form-control:focus { background: var(--bs-body-bg); }

/* ---- Sidebar navigation ---- */
.sidebar-area { border-inline-end: 1px solid var(--edrms-hairline); }
.layout-menu .menu-link {
  border-radius: var(--edrms-radius-sm);
  margin: 2px 10px; padding-block: 9px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.layout-menu .menu-link:hover { background: var(--edrms-tint); color: var(--bs-primary); }
.layout-menu .menu-link:hover .menu-icon { color: var(--bs-primary); }
.layout-menu .menu-link.active {
  background: var(--edrms-tint-strong); color: var(--bs-primary);
  font-weight: 600; position: relative;
}
.layout-menu .menu-link.active .menu-icon,
.layout-menu .menu-link.active .title { color: var(--bs-primary); }
.layout-menu .menu-link.active::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 18%; bottom: 18%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--bs-primary);
}
html[dir="rtl"] .layout-menu .menu-link.active::before { border-radius: 3px 0 0 3px; }
.menu-title-text { letter-spacing: .06em; opacity: .8; }

/* ---- Buttons ---- */
.btn { border-radius: var(--edrms-radius-sm); font-weight: 500; transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease; }
.btn-primary { box-shadow: 0 2px 10px rgba(var(--bs-primary-rgb), .28); border: 0; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(var(--bs-primary-rgb), .38); }
.btn-primary:active { transform: translateY(0); }
.btn-sm { border-radius: 8px; }
.btn:focus-visible { outline: none; box-shadow: var(--edrms-ring); }

/* ---- Forms ---- */
.form-control, .form-select {
  border-radius: var(--edrms-radius-sm);
  border-color: var(--edrms-hairline);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--bs-primary); box-shadow: var(--edrms-ring);
}
.form-label { margin-bottom: .4rem; }

/* ---- Tables ---- */
.table > thead th {
  text-transform: uppercase; font-size: 11px; letter-spacing: .045em;
  color: var(--bs-secondary-color); font-weight: 600;
  border-bottom: 1px solid var(--edrms-hairline);
}
html[dir="rtl"] .table > thead th { text-transform: none; letter-spacing: 0; }
.table > tbody > tr { transition: background-color .12s ease; }
.table > tbody > tr:hover > * { background: var(--edrms-tint); }
.table > :not(caption) > * > * { padding: .8rem .9rem; }

/* ---- Dropdowns ---- */
.dropdown-menu {
  border-radius: 14px; border: 1px solid var(--edrms-hairline) !important;
  box-shadow: var(--edrms-shadow-hover); padding: 6px;
}
.dropdown-item { border-radius: 8px; padding: 8px 12px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--edrms-tint); color: var(--bs-primary); }
.dropdown-item.active { background: var(--bs-primary); color: #fff; }

/* ---- Badges (soft) ---- */
.badge { border-radius: 999px; font-weight: 600; padding: .38em .7em; }

/* ---- Doc icons: slight depth ---- */
.doc-icon { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .03); }

/* ---- Modals ---- */
.modal-content { border-radius: var(--edrms-radius) !important; border: 1px solid var(--edrms-hairline); box-shadow: var(--edrms-shadow-hover); }

/* ---- Scrollbars ---- */
* { scrollbar-width: thin; scrollbar-color: rgba(var(--bs-primary-rgb), .28) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(var(--bs-primary-rgb), .26); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--bs-primary-rgb), .42); background-clip: content-box; }

/* ---- Login page ---- */
.login-page.bg-body-bg {
  background-image:
    radial-gradient(700px 340px at 12% -5%, rgba(var(--bs-primary-rgb), .18), transparent 60%),
    radial-gradient(760px 420px at 100% 105%, rgba(var(--bs-primary-rgb), .12), transparent 60%);
  background-attachment: fixed;
}
.login-card {
  border-radius: 22px !important;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .16), 0 2px 8px rgba(16, 24, 40, .06) !important;
  padding: 34px !important;
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--bs-primary), rgba(var(--bs-primary-rgb), .45));
}
.login-card .text-center > .material-symbols-outlined {
  display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px; font-size: 36px !important; color: #fff !important;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--bs-primary), rgba(var(--bs-primary-rgb), .72));
  box-shadow: 0 10px 24px rgba(var(--bs-primary-rgb), .40);
}
body[data-theme="dark"] .login-card { box-shadow: 0 24px 60px rgba(0, 0, 0, .6) !important; }

/* Motion-safety */
@media (prefers-reduced-motion: reduce) {
  .card, .btn, .form-control, .form-select, .menu-link, .table > tbody > tr { transition: none !important; }
  .btn-primary:hover { transform: none; }
}
