/* =============================================================================
   styles.css — Jarvis Tablet Dashboard
   Target: Samsung Galaxy Tab A (SM-T595) 10.5", landscape, Fully Kiosk Browser
   Design: dark-mode, high-contrast, monospace/terminal aesthetic
   ============================================================================= */

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Colors */
  --clr-bg:         #000000;
  --clr-surface:    #0a0a0a;
  --clr-border:     #1a2a1a;
  --clr-green:      #00ff41;       /* classic terminal green */
  --clr-green-dim:  #00a028;
  --clr-green-glow: rgba(0, 255, 65, 0.12);
  --clr-white:      #e8ffe8;
  --clr-muted:      #3a4f3a;
  --clr-red:        #ff3b3b;
  --clr-amber:      #ffb830;

  /* Typography */
  --font-mono:    'Share Tech Mono', 'Courier New', monospace;
  --font-display: 'Orbitron', sans-serif;

  /* Spacing scale */
  --sp-xs:  0.5rem;
  --sp-sm:  1rem;
  --sp-md:  1.75rem;
  --sp-lg:  3rem;

  /* Transitions */
  --transition-fast: 200ms ease;
  --transition-slow: 600ms ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;                /* kiosk mode — no scrollbars */
  background-color: var(--clr-bg);
  color: var(--clr-green);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  user-select: none;               /* prevent accidental text selection on tablet */
}

/* Subtle scanline CRT effect for that terminal feel */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 999;
}

/* ── Layout Grid ────────────────────────────────────────────────────────────── */
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header"
    "main"
    "footer";
  min-height: 100vh;
  padding: var(--sp-sm);
  gap: var(--sp-sm);
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.hdr {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-xs) var(--sp-md);
  border-bottom: 1px solid var(--clr-border);
}

.hdr__wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  letter-spacing: 0.3em;
  color: var(--clr-green);
  text-shadow:
    0 0 8px  var(--clr-green),
    0 0 20px var(--clr-green-dim);
}

/* Animated glow pulse on wordmark */
.hdr__wordmark {
  animation: glow-pulse 4s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
  from { text-shadow: 0 0 6px var(--clr-green), 0 0 14px var(--clr-green-dim); }
  to   { text-shadow: 0 0 12px var(--clr-green), 0 0 30px var(--clr-green-dim), 0 0 50px rgba(0,255,65,0.3); }
}

/* Status pill (top-right) */
.hdr__status-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 0.35rem 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  background: var(--clr-surface);
  transition: border-color var(--transition-fast);
}

/* Blinking connection dot */
.hdr__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--clr-muted);
  transition: background var(--transition-slow), box-shadow var(--transition-slow);
}

/* JavaScript adds these modifier classes */
.hdr__dot--online {
  background: var(--clr-green);
  box-shadow: 0 0 8px var(--clr-green);
  animation: blink 2s step-end infinite;
}

.hdr__dot--offline {
  background: var(--clr-red);
  box-shadow: 0 0 8px var(--clr-red);
}

.hdr__dot--busy {
  background: var(--clr-amber);
  box-shadow: 0 0 8px var(--clr-amber);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ── Main Section ───────────────────────────────────────────────────────────── */
.main {
  grid-area: main;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* Prevents content from driving column width */
  gap: var(--sp-lg);
  padding: var(--sp-sm) var(--sp-lg);
  height: 100%;
}

.col-left {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.col-right {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  padding: var(--sp-md);
  box-shadow: 0 0 20px var(--clr-green-glow);
  transition: box-shadow var(--transition-slow);
}

.card:hover {
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.2);
}

/* Clock card */
.card--clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: var(--sp-md) var(--sp-lg);
}

.clock {
  font-family: var(--font-mono); /* True monospace prevents text jiggle */
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--clr-white);
  text-shadow: 0 0 15px var(--clr-green-dim);
}

.date {
  font-size: 0.9rem;
  color: var(--clr-green-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Divider */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--clr-green-dim), transparent);
  flex-shrink: 0;
}

/* Command card */
.card--command {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.card__label {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--clr-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--clr-border);
  padding-bottom: var(--sp-xs);
}

.command-text {
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  line-height: 1.5;
  color: var(--clr-white);
  flex: 1;
  display: flex;
  align-items: center;
  /* Smooth text transitions */
  transition: color var(--transition-slow);
}

/* Blinking cursor appended by JS */
.command-text::after {
  content: '█';
  color: var(--clr-green);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}

/* Fast blink animation for command update */
.command-text--flash {
  color: var(--clr-green) !important;
}

.intent-badge {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--clr-green-dim);
  min-height: 1em;
}

/* Calendar Card */
.card--calendar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  overflow: hidden;
}

.calendar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  flex: 1;
  overflow-y: auto;
  padding-right: var(--sp-xs);
}

.calendar-item {
  border-left: 2px solid var(--clr-green-dim);
  padding-left: var(--sp-xs);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.calendar-item__title {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--clr-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-item__time {
  font-size: 0.8rem;
  color: var(--clr-green-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.calendar-item--empty {
  font-style: italic;
  color: var(--clr-muted);
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.ftr {
  grid-area: footer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--clr-muted);
  padding: var(--sp-xs) var(--sp-md);
  border-top: 1px solid var(--clr-border);
  text-transform: uppercase;
}

/* ── Offline overlay — shown when polling fails ─────────────────────────────── */
.offline-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 100;
  font-family: var(--font-display);
  color: var(--clr-red);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.offline-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.offline-overlay__sub {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--clr-muted);
  letter-spacing: 0.15em;
}
