/* ═══════════════════════════════════════════
   CASI Portal — Light Professional Theme
   Adaptive Resonance Technologies LLC
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-surface: #e2e8f0;
  --bg-elevated: #ffffff;

  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --accent-glow: rgba(79, 70, 229, 0.12);
  --accent-2: #7c3aed;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0284c7;
  --info-light: #f0f9ff;

  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ═══ HEADER ═══ */
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-1);
}

.portal-brand:hover { opacity: 0.85; }

.brand-glyph {
  font-size: 1.6rem;
  color: var(--accent);
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.brand-sub {
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: -2px;
}

.portal-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.portal-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.portal-nav a:hover { color: var(--accent); }

.nav-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white !important;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: var(--transition);
}

.nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ═══ BREADCRUMB ═══ */
.breadcrumb {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 2rem 0;
  font-size: 0.8rem;
  color: var(--text-3);
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 0.4rem; }

/* ═══ PAGE HERO ═══ */
.page-hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem 1.5rem;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.page-hero p {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 600px;
}

/* ═══ SECTION ═══ */
.portal-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
}

.section-header .badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
}

/* ═══ CARD GRID ═══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.portal-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.portal-card.clickable { cursor: pointer; }

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.card-icon.indigo   { background: var(--accent-light); }
.card-icon.green    { background: var(--success-light); }
.card-icon.amber    { background: var(--warning-light); }
.card-icon.red      { background: var(--danger-light); }
.card-icon.blue     { background: var(--info-light); }
.card-icon.violet   { background: #f5f3ff; }

.portal-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-1);
}

.portal-card p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.55;
}

.card-arrow {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1rem;
  color: var(--text-3);
  transition: var(--transition);
}

.portal-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ═══ LIST ITEMS ═══ */
.list-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-card-hover); }

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.list-content { flex: 1; min-width: 0; }

.list-content h4 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 0.15rem;
}

.list-content p {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.list-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.meta-tag.agent { background: var(--accent-light); color: var(--accent); }
.meta-tag.time { background: #f1f5f9; color: var(--text-3); }
.meta-tag.status-new { background: var(--info-light); color: var(--info); }
.meta-tag.status-pending { background: var(--warning-light); color: var(--warning); }
.meta-tag.status-read { background: #f1f5f9; color: var(--text-3); }

/* ═══ STATUS INDICATORS ═══ */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.3rem;
}

.status-dot.healthy { background: var(--success); box-shadow: 0 0 6px rgba(5, 150, 105, 0.4); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 6px rgba(217, 119, 6, 0.4); }
.status-dot.critical { background: var(--danger); box-shadow: 0 0 6px rgba(220, 38, 38, 0.4); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.status-badge.healthy { background: var(--success-light); color: var(--success); }
.status-badge.warning { background: var(--warning-light); color: var(--warning); }
.status-badge.critical { background: var(--danger-light); color: var(--danger); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover { background: #047857; }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-1);
}

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.78rem; }

/* ═══ STAT CARDS ═══ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.15rem;
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.35rem; }
.empty-state p { font-size: 0.88rem; color: var(--text-3); }

/* ═══ DETAIL PANEL ═══ */
.detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}

.detail-panel h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.detail-panel p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* ═══ TIMELINE ═══ */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg-card);
  z-index: 1;
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.timeline-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.timeline-content p {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.timeline-time {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 0.35rem;
}

/* ═══ FOOTER ═══ */
.portal-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 2rem;
}

.portal-footer a {
  color: var(--accent);
  text-decoration: none;
}

.portal-footer a:hover { text-decoration: underline; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 640px) {
  .portal-header { padding: 0.9rem 1rem; }
  .portal-nav a:not(.nav-btn) { display: none; }
  .page-hero { padding: 1.5rem 1.25rem 1rem; }
  .page-hero h1 { font-size: 1.5rem; }
  .portal-section { padding: 0 1.25rem 2rem; }
  .card-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .breadcrumb { padding: 1rem 1.25rem 0; }
}
