/* ==========================================================================
   BDIS — Automated Report Generator Engine CSS (Phase AI-3)
   Component: .air-view, .air-reports
   Compliant with BDIS Design Tokens and Dark Glassmorphism Aesthetics
   ========================================================================== */

/* Subnav Tabs within AI Admin View */
.aiadmin-subtabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.aiadmin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aiadmin-tab-btn:hover {
  background: rgba(0, 168, 255, 0.08);
  border-color: var(--primary);
  color: var(--text-main);
}

.aiadmin-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 168, 255, 0.2) 0%, rgba(0, 119, 182, 0.1) 100%);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 168, 255, 0.25);
}

/* Reports Container */
.air-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Control Toolbar */
.air-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  flex-wrap: wrap;
}

.air-toolbar-left, .air-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.air-filter-btn {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.air-filter-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.air-filter-btn.active {
  background: rgba(0, 168, 255, 0.18);
  border-color: var(--primary);
  color: #38bdf8;
}

.air-date-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.air-btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.air-btn-morning {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.3);
}

.air-btn-morning:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.air-btn-nightly {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.air-btn-nightly:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
}

/* Master-Detail Layout */
.air-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  min-height: 600px;
}

@media (max-width: 960px) {
  .air-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar List */
.air-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 800px;
}

.air-sidebar-head {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.air-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.air-card {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.air-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(56, 189, 248, 0.4);
}

.air-card.active {
  background: linear-gradient(135deg, rgba(0, 168, 255, 0.12) 0%, rgba(0, 119, 182, 0.06) 100%);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 168, 255, 0.2);
}

.air-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.air-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.air-badge-morning {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.air-badge-nightly {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.air-card-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.air-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.air-card-stat {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

/* Detail Panel */
.air-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 800px;
}

.air-detail-head {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.air-detail-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.air-detail-meta {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.air-quality-bar {
  background: rgba(14, 28, 49, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.76rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.air-view-tabs {
  display: flex;
  padding: 10px 20px 0 20px;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.air-view-tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.air-view-tab:hover {
  color: var(--text-main);
}

.air-view-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.air-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Markdown Rendering Container */
.air-markdown {
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.6;
}

.air-markdown h1, .air-markdown h2, .air-markdown h3, .air-markdown h4 {
  color: #fff;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  font-weight: 700;
}

.air-markdown h1 { font-size: 1.4rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px; }
.air-markdown h2 { font-size: 1.2rem; }
.air-markdown h3 { font-size: 1.05rem; }

.air-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.82rem;
}

.air-markdown th, .air-markdown td {
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  text-align: left;
}

.air-markdown th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-weight: 700;
}

.air-markdown tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.air-markdown blockquote {
  border-left: 3px solid var(--primary);
  margin: 14px 0;
  padding: 8px 14px;
  background: rgba(0, 168, 255, 0.05);
  color: var(--text-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.air-markdown code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #38bdf8;
}

.air-markdown ul, .air-markdown ol {
  padding-left: 20px;
  margin: 10px 0;
}

.air-markdown li {
  margin-bottom: 4px;
}

/* Structured Grid Components */
.air-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.air-kpi-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
}

.air-kpi-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.air-kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Auth Gate Banner */
.air-auth-gate {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Phase AI-4: Scheduled Report Engine Dashboard Monitoring Bar
   ========================================================================== */
.air-scheduler-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.75) 0%, rgba(30, 41, 59, 0.65) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  backdrop-filter: blur(8px);
  margin-bottom: 4px;
}

.air-sched-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.air-sched-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: #fff;
}

.air-sched-status-badge {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.air-sched-status-badge.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.air-sched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}

.air-sched-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.2s ease;
}

.air-sched-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.air-sched-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.sched-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  margin-bottom: 5px;
  color: var(--text-muted);
}

.sched-info-row strong, .sched-info-row span:last-child {
  color: #e2e8f0;
  font-family: var(--font-mono);
}

.badge-sched-status {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-sched-status.success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-sched-status.failed {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-sched-status.running {
  background: rgba(234, 179, 8, 0.18);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.badge-sched-status.pending {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* ==========================================================================
   Phase AI-5.1: WhatsApp Outbox Monitor & Staging Sandbox UI Styles
   ========================================================================== */

.air-wa-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.air-wa-banner {
  background: linear-gradient(135deg, rgba(14, 28, 49, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.air-wa-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.air-wa-banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.air-wa-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.air-wa-kpi-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.air-wa-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 197, 94, 0.4);
}

.air-wa-kpi-count {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
  margin-top: 4px;
}

.air-wa-kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Toolbar & Filters */
.air-wa-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.air-wa-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Table */
.air-wa-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.air-wa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.air-wa-table th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.air-wa-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

.air-wa-table tr:hover td {
  background: rgba(34, 197, 94, 0.04);
}

/* Badges */
.badge-wa {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-wa.sent {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge-wa.timeout {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-wa.pending {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-wa.failed {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-wa.cancelled {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-wa.processing {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

/* Message Bubble (WhatsApp Look & Feel) */
.air-wa-bubble {
  background: #052e16;
  border: 1px solid #166534;
  border-radius: 8px;
  padding: 16px 20px;
  color: #e2e8f0;
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Modal styling */
.air-wa-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.air-wa-modal-content {
  background: var(--bg-card, #0f172a);
  border: 1px solid var(--border-subtle, #1e293b);
  border-radius: var(--radius-lg, 10px);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.air-wa-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-subtle);
}

.air-wa-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.air-wa-modal-footer {
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}


