/* ─────────────────────────────────────────────────────────
   dashboard.css — MEA Hub Dashboard Base Styles
   DNA: Dark cinematic · Inter body · Bebas Neue brand
   ───────────────────────────────────────────────────────── */

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  --bg:           #0B111E;
  --surface:      #131C2E;
  --surface-2:    #1A2540;
  --border:       #1E2A41;
  --border-2:     #243050;
  --text:         #F0F4F8;
  --text-2:       #8A9AAD;
  --text-3:       #4A5A6D;
  --accent:       #81D4FA;
  --accent-dim:   rgba(129, 212, 250, 0.10);
  --accent-dim-2: rgba(129, 212, 250, 0.06);
  --green:        #00E676;
  --green-dim:    rgba(0, 230, 118, 0.12);
  --red:          #FF5252;

  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  --nav-height: 60px;
  --header-height: 52px;
  --content-max: 680px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ── Reset / Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Loading Overlay ────────────────────────────────────── */
#app-loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
  transition: opacity var(--transition-slow);
}
#app-loading.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-logo {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 2rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App Shell ──────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Main Content Area ──────────────────────────────────── */
.dashboard-main {
  flex: 1;
  padding-top: var(--header-height);
  padding-bottom: calc(var(--nav-height) + 24px);
  padding-left: 16px;
  padding-right: 16px;
}

.dashboard-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Section Divider ────────────────────────────────────── */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Section Label ──────────────────────────────────────── */
.section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

/* ── Welcome / Greeting ─────────────────────────────────── */
.welcome-section {
  padding-bottom: 24px;
}

.welcome-greeting {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.welcome-greeting span {
  color: var(--accent);
}

.welcome-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.welcome-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-2);
}

/* Status dot */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(0, 230, 118, 0.5);
  flex-shrink: 0;
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Live clock */
#live-clock {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* ── Profile Panel ──────────────────────────────────────── */
.profile-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}

.profile-avatar-wrap {
  flex-shrink: 0;
  position: relative;
}

.profile-avatar-img,
.profile-avatar-fallback {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar-fallback {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-bottom: 3px;
}

.profile-sub {
  font-size: 0.75rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Info Rows ──────────────────────────────────────────── */
.info-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.info-row:last-child {
  border-bottom: none;
}

.info-row-label {
  font-size: 0.78rem;
  color: var(--text-3);
  flex-shrink: 0;
  min-width: 90px;
}

.info-row-value {
  font-size: 0.82rem;
  color: var(--text-2);
  text-align: right;
  word-break: break-all;
}

.info-row-value.mono {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.78rem;
}

.info-row-value.accent {
  color: var(--accent);
}

/* Connected accounts count */
.connected-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--text-2);
}
.connected-count-num {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Quick Access ───────────────────────────────────────── */
.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.qa-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.qa-item:hover,
.qa-item:focus-visible {
  background: var(--surface-2);
  border-color: var(--border-2);
  transform: translateY(-1px);
  outline: none;
}

.qa-item:active {
  transform: scale(0.98);
}

.qa-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  flex-shrink: 0;
}

.qa-item-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--transition-fast);
}

.qa-item:hover .qa-item-label {
  color: var(--text);
}

.qa-item-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
}

/* ── Role Sections ──────────────────────────────────────── */
.role-section {
  padding: 16px 0;
}

.role-action-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.role-action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.role-action-item:last-child {
  border-bottom: none;
}

.role-action-item:hover .role-action-label {
  color: var(--text);
}

.role-action-label {
  font-size: 0.85rem;
  color: var(--text-2);
  transition: color var(--transition-fast);
}

.role-action-arrow {
  font-size: 0.75rem;
  color: var(--text-3);
  line-height: 1;
}

/* Owner stats compact row */
.stats-row {
  display: flex;
  gap: 0;
}

.stat-item {
  flex: 1;
  padding: 14px 0;
  border-right: 1px solid var(--border);
}
.stat-item:last-child {
  border-right: none;
  padding-left: 16px;
}
.stat-item:first-child {
  padding-right: 16px;
}
.stat-item:not(:first-child):not(:last-child) {
  padding: 14px 16px;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── System Status ──────────────────────────────────────── */
.system-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.system-status-label {
  font-size: 0.8rem;
  color: var(--text-2);
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--green);
}

.system-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px rgba(0, 230, 118, 0.4);
}

/* ── Utilities ──────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Desktop ─────────────────────────────────────────────── */
@media (min-width: 768px) {
  .dashboard-main {
    padding-left: 24px;
    padding-right: 24px;
  }

  .dashboard-content {
    padding-top: 36px;
  }

  .welcome-greeting {
    font-size: 1.65rem;
  }

  .quick-access-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  :root {
    --content-max: 780px;
  }
}
