/* =============================================================================
   Yah Digital — dashboard components   brand.css
   App-specific components (auth, board, tickets, sidebar, markdown, badges…).
   Brand tokens, typography and buttons live in style.css — loaded before this.
   ============================================================================= */

:root {
  /* Status + weight colours (dashboard-specific) */
  --yah-todo:         #94a3b8;
  --yah-progress:     #3b82f6;
  --yah-done:         #10b981;
  --yah-weight-low:   #94a3b8;
  --yah-weight-medium:#3b82f6;
  --yah-weight-high:  #f59e0b;
  --yah-weight-urgent:#ef4444;
}

/* --- Auth screens --- */
.auth-shell {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(var(--yah-primary-rgb), 0.10), transparent 60%),
    var(--yah-bg-body);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--yah-bg-surface-1);
  border: 1px solid var(--yah-border);
  border-radius: var(--yah-radius);
  box-shadow: var(--yah-shadow-lg);
  padding: 2rem;
}
.brand-mark {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
  color: var(--yah-body-color);
}
.brand-mark span { color: var(--yah-primary-light); }

/* Official Yah Digital wordmark (theme-aware SVG pair). */
.brand-logo { height: 30px; width: auto; display: block; }
.app-sidebar .brand-logo { height: 28px; }
.auth-card .brand-logo { height: 34px; margin: 0 auto; }

/* Show the wordmark that matches the active theme. */
.brand-logo[data-logo] { display: none; }
[data-bs-theme="light"] .brand-logo[data-logo="light"] { display: block; }
[data-bs-theme="dark"]  .brand-logo[data-logo="dark"]  { display: block; }
.auth-card .brand-logo[data-logo] { margin: 0 auto; }

/* Rendered markdown (ticket descriptions + comments). */
.markdown-body { line-height: 1.5; }
.markdown-body :first-child { margin-top: 0; }
.markdown-body :last-child { margin-bottom: 0; }
.markdown-body pre {
  background: var(--yah-bg-surface-2);
  border: 1px solid var(--yah-border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  overflow: auto;
}
.markdown-body code { font-size: 0.85em; }
.markdown-body ul { padding-left: 1.2rem; }
.markdown-body p { margin: 0 0 0.75rem; }
.markdown-body li { margin: 0.2rem 0; }
.markdown-body input[type="checkbox"] {
  margin-right: 0.45rem;
  transform: translateY(1px);
}
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--yah-border);
  display: block;
  margin: 0.5rem 0;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid var(--yah-border);
  padding: 0.4rem 0.5rem;
  vertical-align: top;
}
.markdown-body blockquote {
  border-left: 3px solid var(--yah-border-strong);
  margin: 0.75rem 0;
  padding: 0.2rem 0 0.2rem 0.75rem;
  color: var(--yah-muted);
}

/* Ticket modal comments + composer */
.ticket-comments-thread {
  background: color-mix(in oklab, var(--yah-bg-surface-2) 78%, transparent);
  border: 1px solid var(--yah-border);
  border-radius: 12px;
  padding: 0.85rem;
}

.ticket-comment {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.ticket-comment:first-of-type {
  border-top: 0 !important;
  padding-top: 0.35rem !important;
}

.comment-composer-wrap {
  background: color-mix(in oklab, var(--yah-bg-surface-1) 88%, transparent);
  border: 1px solid var(--yah-border);
  border-radius: 12px;
  padding: 0.85rem;
}

.comment-composer-wrap hr {
  margin-top: 0;
}

.comment-editor-shell {
  max-width: 780px;
}

.comment-editor-shell .EasyMDEContainer {
  max-width: 100%;
}

.ticket-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ticket-attachment-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  background: var(--yah-bg-surface-1);
  border: 1px solid var(--yah-border);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}

.ticket-attachment-image-wrap {
  width: min(260px, 100%);
}

.ticket-attachment-image {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--yah-border);
  display: block;
}

/* --- App chrome / sidebar --- */
.app-sidebar {
  background: var(--yah-bg-surface-1);
  border-right: 1px solid var(--yah-border);
  color: var(--yah-body-color);
  padding: 1rem;
}
.app-sidebar .sidebar-inner { min-height: 100%; }
.sidebar-brand { display: inline-flex; align-items: center; }

/* Hamburger toggler (mobile / tablet only) */
.sidebar-toggler {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--yah-body-color);
  background: var(--yah-bg-surface-2);
  border: 1px solid var(--yah-border);
  border-radius: var(--yah-radius);
  cursor: pointer;
  transition: color var(--yah-transition-fast), background-color var(--yah-transition-fast), border-color var(--yah-transition-fast);
}
.sidebar-toggler:hover { border-color: var(--yah-border-strong); }
.sidebar-toggler:focus-visible { outline: 2px solid var(--yah-primary-light); outline-offset: 2px; }
.sidebar-toggler[aria-expanded="true"] {
  color: #fff;
  background: var(--yah-primary-light);
  border-color: var(--yah-primary);
}

.app-sidebar .brand-mark { color: var(--yah-body-color); }
.app-sidebar .nav-link {
  color: var(--yah-muted);
  border: 1px solid transparent;
  border-radius: var(--yah-radius);
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  transition: color var(--yah-transition-fast), background-color var(--yah-transition-fast), border-color var(--yah-transition-fast);
}
.app-sidebar .nav-link:hover { color: var(--yah-body-color); background: var(--yah-bg-surface-2); }
/* Subtle active state — surface fill + form-field-style border, red icon accent */
.app-sidebar .nav-link.active {
  color: var(--yah-body-color);
  background: var(--yah-bg-surface-2);
  border-color: var(--yah-border-strong);
}
.app-sidebar .nav-link.active:hover { color: var(--yah-body-color); background: var(--yah-bg-surface-2); }
.app-sidebar .nav-link.active .bi { color: var(--yah-primary-light); }
.app-sidebar .user-email { color: var(--yah-body-color); font-weight: 600; padding: 0 0.85rem; }
.app-sidebar .sidebar-footer { border-top: 1px solid var(--yah-border); }

/* Desktop (lg+): full-height vertical sidebar */
@media (min-width: 992px) {
  .app-sidebar { min-height: 100vh; padding: 1.5rem 1rem; }
  .app-sidebar .sidebar-menu { margin-top: 1.5rem; }
}

/* Mobile / tablet: collapses into a sticky hamburger bar */
@media (max-width: 991.98px) {
  .app-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--yah-border);
    position: sticky;
    top: 0;
    z-index: 1030;
  }
  .app-sidebar .sidebar-menu { margin-top: 0.75rem; }
  .app-sidebar .sidebar-menu.show,
  .app-sidebar .sidebar-menu.collapsing {
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
  }
}

/* --- Theme toggle (segmented pill, base of sidebar) --- */
.theme-toggle {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--yah-bg-surface-2);
  border: 1px solid var(--yah-border);
}
.theme-toggle__btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--yah-muted);
  border-radius: 999px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: color var(--yah-transition-fast), background-color var(--yah-transition-fast), box-shadow var(--yah-transition-fast);
}
.theme-toggle__btn .bi { font-size: 0.95rem; }
.theme-toggle__btn:hover { color: var(--yah-body-color); }
.theme-toggle__btn:focus-visible { outline: 2px solid var(--yah-primary-light); outline-offset: 2px; }
.theme-toggle__btn.active {
  color: var(--yah-body-color);
  background: var(--yah-bg-surface-1);
  box-shadow: var(--yah-shadow-sm);
}
[data-bs-theme="dark"] .theme-toggle__btn.active { color: #fff; }

/* Floating theme toggle for auth screens (no sidebar). */
.theme-toggle-floating {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 1090;
  width: auto;
}

.app-main { padding: 1.75rem; }

/* --- Waiting-for-feedback emphasis --- */
.ticket-waiting { border-color: var(--yah-weight-urgent); box-shadow: inset 0 0 0 1px var(--yah-weight-urgent); }
.waiting-banner {
  display: inline-flex; align-items: center;
  background: var(--yah-weight-urgent); color: #fff;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 6px; padding: 0.15rem 0.5rem; margin-bottom: 0.5rem;
}

/* --- Ticket labels --- */
.ticket-labels { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ticket-label {
  font-size: 0.68rem; padding: 0.05rem 0.5rem; border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.45);
  background: rgba(139, 148, 158, 0.14);
  color: var(--yah-body-color);
}

/* --- Grouped (row) board view --- */
.board-group-header {
  width: 100%; text-align: left; background: transparent; border: none;
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.5rem 0.25rem; color: var(--yah-body-color);
  border-bottom: 1px solid var(--yah-border);
}
.board-group-header .group-caret { transition: transform 0.15s ease; }
.board-group-header[aria-expanded="false"] .group-caret { transform: rotate(-90deg); }
.board-group-header .board-column-count { background: var(--yah-bg-surface-2); border-radius: 999px; padding: 0 0.5rem; font-size: 0.75rem; }
.board-group-body { padding: 0.75rem 0.25rem; }
@media (min-width: 768px) {
  .board-group-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; align-items: start; }
  .board-group-body .ticket-card { margin-bottom: 0 !important; }
}

/* --- Documents / invoices cards --- */
.doc-card {
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.doc-card:hover {
  box-shadow: var(--yah-shadow);
  transform: translateY(-1px);
}
.doc-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yah-bg-surface-2);
  border-bottom: 1px solid var(--yah-border);
  color: var(--yah-muted);
}
.doc-thumb .bi { font-size: 3.25rem; }
.doc-thumb-img { padding: 0; overflow: hidden; }
.doc-thumb-img img { width: 100%; height: 100%; object-fit: cover; }

.card {
  border: 1px solid var(--yah-border);
  border-radius: 12px;;
}

/* --- Board / tickets --- */
.board-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.board-column {
  flex: 0 0 300px;
  max-width: 300px;
  background: var(--yah-bg-surface-2);
  border-radius: 12px;;
  padding: 0.75rem 0.75rem 0.4rem;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px);
}
.board-column-body {
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}
.board-column-count {
  background: var(--yah-border);
  border-radius: 999px;
  padding: 0 0.5rem;
  font-size: 0.75rem;
}
.board-column-empty {
  border: 1px dashed var(--yah-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  background: var(--yah-bg-surface-1);
}
@media (max-width: 575.98px) {
  .board-column { flex-basis: 85vw; max-width: 85vw; }
}
.board-column-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--yah-muted);
  font-weight: 700;
}
.ticket-card {
  background: var(--yah-bg-surface-1);
  border: 1px solid var(--yah-border);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.ticket-card:hover { box-shadow: var(--yah-shadow); transform: translateY(-1px); }
.ticket-title { font-weight: 600; line-height: 1.3; }
.ticket-desc-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ticket-meta { gap: 0.4rem; flex-wrap: wrap; }

/* High-level top progress bar shown during load / background refresh. */
.top-loader {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  z-index: 1080;
  overflow: hidden;
  background: transparent;
}
.top-loader .bar {
  height: 100%;
  width: 35%;
  background: var(--yah-primary-light);
  border-radius: 0 3px 3px 0;
  animation: top-loader-slide 1.1s infinite ease-in-out;
}
@keyframes top-loader-slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

.badge-weight { font-weight: 600; }
.badge-weight-low { background: var(--yah-weight-low); }
.badge-weight-medium { background: var(--yah-weight-medium); }
.badge-weight-high { background: var(--yah-weight-high); }
.badge-weight-urgent { background: var(--yah-weight-urgent); }

.progress-slim { height: 8px; border-radius: 999px; }

.empty-state {
  border: 1px dashed var(--yah-border);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--yah-muted);
}

.skeleton {
  background: linear-gradient(90deg, var(--yah-bg-surface-2) 25%, var(--yah-bg-surface-1) 37%, var(--yah-bg-surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 12px;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* .btn-primary handled by style.css */
