/*
 * AppTriage — Brand Overrides
 *
 * Loaded after Tabler CSS in base.html.
 * Provides consistent typography, form styling, and button treatment
 * across all surfaces (dashboard, auth, onboarding, public).
 *
 * Keep minimal. Only override what Tabler can't do natively.
 */


/* ── Alpine.js x-cloak ── */
[x-cloak] { display: none !important; }

/* ── Brand Variables ── */

:root {
  --tblr-font-sans-serif: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --at-slate: #121317;
  --at-slate-mid: #18191D;
  --at-muted: #45474D;
  --at-border: #E1E6EC;
  --at-surface: #F8F9FC;
}


/* ── Global Typography ── */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}


/* ── Form Controls ── */

.form-control,
.form-select {
  border-radius: 8px;
  border-color: var(--at-border);
  font-size: .875rem;
  letter-spacing: -0.005em;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--at-slate);
  box-shadow: 0 0 0 2px rgba(18, 19, 23, 0.08);
}

.input-group-flat .form-control {
  border-radius: 8px 0 0 8px;
}

.input-group-flat .input-group-text {
  border-radius: 0 8px 8px 0;
  border-color: var(--at-border);
}


/* ── Form Labels ── */

.form-label {
  font-weight: 500;
  font-size: .8125rem;
  letter-spacing: -0.005em;
  color: var(--at-muted);
}

.form-hint {
  color: var(--at-muted);
  letter-spacing: -0.005em;
}


/* ── Primary Buttons ──
 * Scoped to .page (dashboard + auth) and .modal contexts.
 */

.page .btn-primary,
.modal .btn-primary {
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: -0.01em;
}

.page .btn-primary:hover,
.page .btn-primary:focus,
.modal .btn-primary:hover,
.modal .btn-primary:focus {
  box-shadow: 0 2px 8px rgba(32, 107, 196, 0.18);
}


/* ── Inbox Filter Tabs ── */

.at-tab,
.at-tab-active {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
/* Fix status-dot vertical alignment inside tabs */
.at-tab .status-dot,
.at-tab-active .status-dot {
  vertical-align: middle;
  position: relative;
  top: 0;
}

.at-tab {
  color: #64748b;
}

.at-tab:hover {
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
}

.at-tab-active {
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 600;
}

.at-tab-active:hover {
  background: #cbd5e1;
  color: #1e293b;
  text-decoration: none;
}

/* Dark mode tabs */
[data-bs-theme="dark"] .at-tab {
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .at-tab:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff !important;
}

[data-bs-theme="dark"] .at-tab-active {
  background: rgba(255, 255, 255, .18);
  color: #fff !important;
  font-weight: 600;
}

[data-bs-theme="dark"] .at-tab-active:hover {
  background: rgba(255, 255, 255, .24);
  color: #fff !important;
}

/* ── Demo Data Indicator ── */

.at-demo {
  border: 1px dashed #ef4444;
  border-radius: 8px;
  padding: 12px 16px;
}

.at-demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.at-demo-ic {
  color: #94a3b8;
  flex-shrink: 0;
}

.at-demo-msg {
  font-size: .875rem;
  color: #64748b;
  flex: 1;
  min-width: 0;
}

.at-demo-msg strong {
  color: #334155;
  font-weight: 600;
}

.at-demo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Dark mode */
[data-bs-theme="dark"] .at-demo {
  border-color: #ef4444;
}

[data-bs-theme="dark"] .at-demo-ic {
  color: #64748b;
}

[data-bs-theme="dark"] .at-demo-msg {
  color: #94a3b8;
}

[data-bs-theme="dark"] .at-demo-msg strong {
  color: #e2e8f0;
}

/* ── Dashboard Light Navbar ── */

.page > .navbar {
  background: #fff;
  border-bottom: 1px solid var(--at-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.page > .navbar .nav-link {
  font-size: .875rem;
  letter-spacing: -0.005em;
}

.page > .navbar .nav-item.active .nav-link {
  font-weight: 600;
}


/* ── Navbar Brand Wordmark ── */

.navbar-brand-text-inner {
  font-weight: 500;
  color: var(--at-slate);
  letter-spacing: -0.02em;
}


/* ── Card Borders ── */

.page-body .card,
.page-center .card {
  border-color: var(--at-border);
}

.page-center .card-md {
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}


/* ── Card Titles ── */

.card-title {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-subtitle {
  letter-spacing: -0.005em;
}


/* ── Tabs (inside cards) ── */

.nav-tabs .nav-link.active {
  font-weight: 600;
  color: var(--at-slate);
  border-bottom-color: var(--at-slate);
}

.nav-tabs .nav-link {
  font-size: .875rem;
  letter-spacing: -0.005em;
}


/* ── Textareas ── */

textarea.form-control {
  line-height: 1.6;
}


/* ── Alerts ── */

.alert {
  border-radius: 10px;
}


/* ── Brand Logo (shared by auth + onboarding) ── */

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}

.auth-brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-text {
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--at-slate);
  letter-spacing: -0.02em;
}

.auth-brand:hover .auth-brand-text {
  color: var(--at-slate);
}


/* ── Links ── */

.page-body a:not(.btn):not(.nav-link):not(.list-group-item):not(.dropdown-item):not(.page-link),
.page-center a:not(.btn):not(.nav-link):not(.list-group-item):not(.dropdown-item) {
  color: #0054a6;
}


/* ── Form label description (e.g., "Forgot password?") ── */

.form-label-description a {
  font-weight: 500;
  font-size: .8125rem;
}


/* ── HTMX Loading States ── */

.htmx-request .htmx-indicator {
  display: inline-block !important;
}

.htmx-indicator {
  display: none;
}

/* Subtle opacity transition for HTMX-swapped content */
.htmx-added {
  animation: htmxFadeIn 0.2s ease-out;
}

@keyframes htmxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Content area dims slightly while loading */
.htmx-request.htmx-settling {
  opacity: 0.7;
  transition: opacity 0.15s ease;
}


/* ── Empty State Illustrations ── */

.empty-state-illustration {
  max-width: 180px;
  height: auto;
}


/* ── Dark Mode Fallbacks ── */

[data-bs-theme="dark"] .page > .navbar {
  background: var(--tblr-bg-surface);
  border-bottom-color: var(--tblr-border-color);
  box-shadow: none;
}

[data-bs-theme="dark"] .navbar-brand-text-inner {
  color: #fff;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  border-color: var(--tblr-border-color);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 2px rgba(32, 107, 196, 0.15);
}

[data-bs-theme="dark"] .form-label {
  color: var(--tblr-secondary-color);
}

[data-bs-theme="dark"] .auth-brand-text {
  color: #fff;
}

[data-bs-theme="dark"] .page-body .card,
[data-bs-theme="dark"] .page-center .card {
  border-color: var(--tblr-border-color);
}

/* Dark mode: Tabler handles btn-primary natively — no override needed */

/* ── Over-limit blur (plan limit enforcement) ─── */
.feedback-blurred {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.over-limit-overlay {
  position: relative;
}

.over-limit-lock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  white-space: nowrap;
}

/* ── Credential / config boxes ────────────────── */
.credentials-box {
  background: var(--at-surface);
  border-radius: 10px;
  padding: 1.25rem;
}

[data-bs-theme="dark"] .credentials-box {
  background: var(--tblr-bg-surface);
}

/* ── AI classification badges ─────────────────── */
.badge-dashed {
  border: 1px dashed currentColor;
}

[data-bs-theme="dark"] .subheader {
  color: var(--tblr-secondary-color);
}


/* ── Inbox Filter Tab Scroll ── */

@media (max-width: 767.98px) {
  .at-tabs-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .at-tabs-scroll::-webkit-scrollbar { display: none; }
}


/* ── Delete Button: muted by default, red on hover ── */
.btn-delete-muted {
  color: #94a3b8 !important;
}
.btn-delete-muted:hover {
  color: var(--tblr-danger) !important;
  background: rgba(var(--tblr-danger-rgb), .06) !important;
}

/* ── Project Card Links ── */
.at-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  transition: background .15s, color .15s;
  min-height: 44px;
}
.at-card-link:hover {
  background: #f1f5f9;
  color: #1e293b;
  text-decoration: none;
}
.at-card-link-primary {
  color: var(--tblr-primary);
}
.at-card-link-primary:hover {
  background: rgba(var(--tblr-primary-rgb), .08);
  color: var(--tblr-primary);
}

/* ── Inbox Row Hover ── */

.list-group-item-action:hover {
  background-color: rgba(var(--tblr-primary-rgb), .04) !important;
}
