/* ============================================================
   Port Logic Tramp — adapter layer on top of the Aviation design system
   (css/av/av.css). Everything here is either
     (a) glue the Angular app gets from its framework (sidebar state, toasts…)
     (b) styles for Tramp-only screens, written with the Aviation tokens, or
     (c) direction-neutral rules using logical properties.
   Direction-specific fixes live in plt.rtl.css.
   ============================================================ */

/* ── Base ───────────────────────────────────────────────── */
body.plt-body { background: var(--bg-primary); }
[hidden] { display: none !important; }
.skip-link { position: absolute; inset-inline-start: -9999px; top: 0; z-index: 10000; background: #0f172a; color: #fff; padding: .5rem 1rem; border-radius: 0 0 .5rem .5rem; }
.skip-link:focus { inset-inline-start: 1rem; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.icon { flex-shrink: 0; vertical-align: middle; }
body, button, input, select, textarea { font-family: var(--font-body); }
html[lang="ar"] body, html[lang="ar"] button, html[lang="ar"] input, html[lang="ar"] select, html[lang="ar"] textarea {
  font-family: 'Cairo', 'Inter', sans-serif;
}
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] h4,
html[lang="ar"] .brand-logo__name, html[lang="ar"] .brand-name { font-family: 'Cairo', 'Outfit', sans-serif; letter-spacing: 0; }
html[lang="ar"] .nav-group__label, html[lang="ar"] .form-label, html[lang="ar"] .field-label, html[lang="ar"] th { letter-spacing: 0; }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.fw-600 { font-weight: 600; }

/* ── App shell: sidebar state is html.sb-open ───────────────
   (the Angular app toggles .sidebar--open / .main-wrapper--expanded) */
.sidebar { transform: translateX(-100%); }
html.sb-open .sidebar { transform: translateX(0); box-shadow: 8px 0 40px rgba(0, 0, 0, .35); }
.sidebar-backdrop { display: none; }
@media (min-width: 769px) {
  html.sb-open .sidebar { box-shadow: none; }
  html:not(.sb-open) .main-wrapper { margin-left: 0; margin-right: 0; width: 100%; }
  html.sb-open .main-wrapper { margin-left: 260px; width: calc(100% - 260px); }
}
@media (max-width: 768px) {
  html.sb-open .sidebar-backdrop { display: block; }
  html.sb-open { overflow: hidden; }
}
.brand-logo__img { border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(245, 158, 11, .35), 0 0 12px rgba(245, 158, 11, .25); }
.brand-logo__icon { animation: none; }
.user-dropdown[hidden] { display: none; }
.user-dropdown form { margin: 0; }
.user-dropdown__item { text-align: start; }
a.nav-link, a.module-btn, a.header-btn { text-decoration: none; }
a.module-btn { display: inline-flex; align-items: center; }
.header-btn { text-decoration: none; }
.top-header { position: sticky; }
.page-body { min-width: 0; }

/* network banner */
.network-banner { display: none; position: fixed; top: 0; inset-inline: 0; z-index: 10001; background: #b45309; color: #fff; padding: .35rem 1rem; font-size: .8rem; font-weight: 600; text-align: center; align-items: center; justify-content: center; gap: .5rem; }
.network-banner.show { display: flex; }

/* ── Toasts (hub pl-toast) ──────────────────────────────── */
.pl-toast-container { position: fixed; bottom: 1.5rem; inset-inline-end: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .625rem; }
.pl-toast { position: relative; display: flex; align-items: flex-start; gap: .75rem; }
.pl-toast--success { border-inline-start: 4px solid #10b981; border-left-width: 4px; }
.pl-toast__icon { width: 18px; height: 18px; margin-top: 1px; }
.pl-toast__body { flex: 1; min-width: 0; }
.pl-toast--error .pl-toast__icon { color: #ef4444; }
.pl-toast__close { background: none; border: 0; color: var(--text-muted); font-size: 1.25rem; line-height: 1; cursor: pointer; padding: 0 .25rem; }
.pl-toast__close:hover { color: var(--text-primary); }
.pl-toast__title { overflow-wrap: anywhere; }

/* ── Confirm dialog / modals ────────────────────────────── */
.plt-confirm-overlay { z-index: 9998; pointer-events: auto; }
.plt-confirm-overlay[hidden] { display: none; }
.pl-confirm__icon--danger { background: var(--error-bg); color: var(--error); }
.pl-confirm__icon--info { background: var(--info-bg); color: var(--blue); }
.pl-confirm { text-align: center; padding: 1.5rem 1.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.pl-confirm__icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pl-confirm__title { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; margin: 0; }
.pl-confirm__message { font-size: .84rem; color: var(--text-secondary); margin: 0; line-height: 1.5; }

/* ── Command palette extras ─────────────────────────────── */
.cp-overlay[hidden], .cp-modal[hidden] { display: none; }
a.cp-item { text-decoration: none; }
.cp-item { text-align: start; }

/* ── Login extras ───────────────────────────────────────── */
body.plt-auth { background: var(--bg-base); }
.login-page { position: relative; }
.login-error--ok { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.checkbox-label input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.field-input[type=password] { padding-inline-end: 2.75rem; }
.plt-lang-switch { position: fixed; top: 1rem; inset-inline-end: 1rem; z-index: 20; display: flex; gap: .5rem; }
.plt-lang-switch__btn { display: inline-flex; align-items: center; height: 32px; padding: 0 .85rem; border-radius: 8px; background: rgba(255,255,255,.9); border: 1px solid var(--border-medium); color: var(--text-secondary); font-size: .78rem; font-weight: 600; text-decoration: none; backdrop-filter: blur(6px); transition: all var(--ease-fast); }
.plt-lang-switch__btn:hover { color: var(--blue); border-color: var(--border-blue); background: #fff; }

/* ── Dashboard additions (Tramp-only widgets, Aviation tokens) ── */
.dsh-hero__currency { font-family: var(--font-body); font-size: .72rem; font-weight: 600; color: #94a3b8; letter-spacing: .04em; }
.dsh-hero__item--link, .dsh-qa-btn, .dsh-alert-banner__action, .dsh-refresh-btn, .dsh-jobs__tab { text-decoration: none; }
.dsh-pipeline-stage--red { }
.dsh-pipeline-stage--red .dsh-pipeline-stage__icon { background: #fee2e2; color: #dc2626; }
.dsh-pipeline-stage--red.dsh-pipeline-stage--active { border-color: #ef4444; }
.dsh-pipeline-stage--red.dsh-pipeline-stage--active .dsh-pipeline-stage__count { color: #dc2626; }
.dsh-attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.dsh-list { list-style: none; margin: 0; padding: 0; }
.dsh-list li + li { border-top: 1px solid rgba(0, 0, 0, .05); }
.dsh-list__row { display: flex; align-items: center; gap: .75rem; padding: .8rem 1.25rem; text-decoration: none; color: inherit; transition: background .12s; }
.dsh-list__row:hover { background: rgba(37, 99, 235, .035); }
.dsh-list__meta { flex: 1; min-width: 0; font-size: .78rem; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-list__file { flex: 1; min-width: 0; font-size: .82rem; font-weight: 600; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-list__empty { padding: 1.5rem 1.25rem; text-align: center; color: #9ca3af; font-size: .82rem; }
.dsh-jobs__search-clear { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.dsh-refresh-btn { display: inline-flex; align-items: center; gap: .4rem; }

/* hub modal animations referenced CSS variables the Aviation bundle does not define */
.pl-overlay { animation: fadeIn .15s ease both; }
.pl-modal { animation: scaleIn .18s cubic-bezier(.22, 1, .36, 1) both; background: #fff; border: 1px solid var(--border-light); border-radius: 1.375rem; box-shadow: var(--shadow-2xl); width: 540px; max-width: calc(100vw - 32px); }
.plt-confirm-overlay { background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; position: fixed; inset: 0; }
.plt-confirm-overlay[hidden] { display: none !important; }

/* Signed-out pages (error pages): no sidebar or top bar, just the content */
.app-shell--bare .sidebar, .app-shell--bare .sidebar-backdrop, .app-shell--bare .top-header { display: none !important; }
.app-shell--bare .main-wrapper { margin-inline-start: 0 !important; margin-left: 0 !important; }

/* Demo account shortcuts on the login page (shown only when the app passes demo_accounts) */
.plt-demo { margin-top: 18px; padding-top: 16px; border-top: 1px dashed rgba(148, 163, 184, .45); text-align: center; }
.plt-demo__title { display: block; margin-bottom: 10px; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.plt-demo__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.plt-demo__btn { cursor: pointer; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, .5); background: transparent; color: inherit; font: inherit; font-size: .82rem; }
.plt-demo__btn:hover { border-color: #2563eb; color: #2563eb; background: rgba(37, 99, 235, .08); }

/* Collapsible sidebar groups (a group with a title and 2+ items). The current page's group is always open.
   The header is a full-width menu row, so it reads as something to click. */
.nav-group--collapsible { margin-bottom: .25rem; }
.nav-group__toggle {
  width: 100%; background: none; border: 0; cursor: pointer; text-align: start; font-family: inherit;
  padding: .8rem 1.25rem; gap: .75rem; font-size: .76rem; letter-spacing: .09em; color: rgba(255, 255, 255, .62);
  border-inline-start: 2px solid transparent; transition: background .15s, color .15s;
}
.nav-group__toggle > svg:first-child { width: 15px; height: 15px; opacity: .8; flex: none; }
.nav-group__toggle:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-group__toggle:focus-visible { outline: 2px solid rgba(147, 197, 253, .7); outline-offset: -2px; border-radius: 6px; }
.nav-group__title { flex: 1; text-align: start; }
.nav-group__count { font-size: .68rem; font-weight: 600; min-width: 22px; padding: 2px 7px; border-radius: 999px; text-align: center;
  background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .6); letter-spacing: 0; }
.nav-group__chevron { width: 14px; height: 14px; flex: none; transition: transform .18s ease; opacity: .8; }
.nav-group--collapsible.is-collapsed .nav-group__chevron { transform: rotate(-90deg); }
[dir="rtl"] .nav-group--collapsible.is-collapsed .nav-group__chevron { transform: rotate(90deg); }
.nav-group--collapsible.is-collapsed .nav-group__items { display: none; }
/* the open group: brighter header with an accent edge, so it is clear which section you are in */
.nav-group--collapsible:not(.is-collapsed) .nav-group__toggle { color: #fff; border-inline-start-color: #f59e0b; background: rgba(255, 255, 255, .04); }
.nav-group--collapsible:not(.is-collapsed) { margin-bottom: .6rem; }
