/* ═══════════════════════════════════════════════════════════
   layout.css — Desktop Grid, Zone Positioning, Responsive
   Callisto OS // ARCNET Terminal v2.0
   ═══════════════════════════════════════════════════════════ */

/* ── Boot Overlay ── */
.boot {
  position: fixed;
  inset: 0;
  background: #050810;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity .6s ease, visibility .6s ease;
}
.boot.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-inner {
  width: min(960px, 90vw);
  height: min(480px, 65vh);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% -30%, rgba(0, 212, 255, .12), transparent 40%),
    var(--bg-surface);
  box-shadow: var(--glow);
  padding: 16px;
  display: grid;
  grid-template-rows: 24px 1fr 40px;
  gap: 10px;
}

.boot-header { font-size: .82rem; letter-spacing: 1px; }

.boot-screen {
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  padding: 10px;
  font-size: .9rem;
  line-height: 1.6;
}

.boot-footer { display: flex; align-items: center; gap: 12px; }

.boot-progress {
  flex: 1;
  height: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.boot-progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), transparent);
  box-shadow: inset 0 0 16px var(--accent-glow);
  transition: width .25s ease;
}

/* ══════════════════════════════════════
   Shell Grid
   ══════════════════════════════════════ */
.shell {
  display: grid;
  height: 100vh;
  grid-template-rows: 40px 1fr var(--bottom-h) 28px;
  grid-template-columns: var(--left-w) 1fr var(--right-w);
  grid-template-areas:
    "header   header    header"
    "sysmon   desktop   netpanel"
    "bottom   bottom    bottom"
    "footer   footer    footer";
  gap: var(--gap);
  padding: var(--gap);
  background-image:
    radial-gradient(circle at 0 0, rgba(0, 212, 255, .08), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(0, 212, 255, .04), transparent 30%);
}

/* ── Zone Base ── */
.zone {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px var(--bg), var(--glow-subtle);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

/* ══════════════════════════════════════
   Header
   ══════════════════════════════════════ */
.zone-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background:
    linear-gradient(180deg, rgba(0, 212, 255, .06), transparent),
    var(--bg-surface);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 14px var(--accent), 0 0 30px var(--accent-glow); }
}

.header-title { font-size: .85rem; white-space: nowrap; }
.header-version { font-size: .72rem; }

.header-clock {
  color: var(--accent);
  font-size: .95rem;
  text-shadow: var(--glow-text);
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   System Monitor (Left)
   ══════════════════════════════════════ */
.zone-sysmon {
  grid-area: sysmon;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--pad);
  overflow-y: auto;
}

.sysmon-clock {
  text-align: center;
  padding: 8px 0 10px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 8px;
}

.clock-time {
  font-size: 2.6rem;
  color: var(--accent);
  text-shadow: var(--glow-text);
  letter-spacing: 4px;
  line-height: 1;
}

.clock-date {
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 1px;
}

.sysmon-info {
  padding: 4px 0 8px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 6px;
}

.sysmon-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: .82rem;
}

.sysmon-procs {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.procs-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.procs-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.procs-table th,
.procs-table td {
  padding: 3px 4px;
  border-bottom: 1px dotted rgba(26, 35, 50, .8);
  white-space: nowrap;
  text-align: left;
}
.procs-table th {
  color: var(--text-dim);
  font-weight: normal;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
}
.procs-table tr:hover { background: rgba(0, 212, 255, .04); }
.procs-table tr.active { background: rgba(0, 212, 255, .1); color: var(--accent); }

/* ══════════════════════════════════════
   Desktop Workspace (Center)
   ══════════════════════════════════════ */
.zone-desktop {
  grid-area: desktop;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  position: relative;
}

/* The canvas where windows live */
.desktop-canvas {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(0, 212, 255, .03), transparent 60%),
    var(--bg-surface);
}

/* Desktop shortcut icons grid */
.desktop-icons {
  position: absolute;
  inset: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  pointer-events: none; /* let clicks pass through to windows */
  z-index: 0;
}
.desktop-icons > * {
  pointer-events: auto; /* but icons themselves are clickable */
}

/* ── Taskbar (bottom of desktop zone) ── */
.taskbar {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 6px;
  border-top: 1px solid var(--border);
  background:
    linear-gradient(0deg, rgba(0, 212, 255, .04), transparent),
    var(--bg-inset);
  flex-shrink: 0;
  gap: 4px;
}

.taskbar-start {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
  color: var(--accent);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.taskbar-start:hover {
  background: rgba(0, 212, 255, .1);
  border-color: var(--accent-dim);
  box-shadow: 0 0 8px var(--accent-glow);
}
.taskbar-start.open {
  background: rgba(0, 212, 255, .15);
  border-color: var(--accent);
}

.taskbar-apps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.taskbar-tray {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: .78rem;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

/* ══════════════════════════════════════
   Network Panel (Right)
   ══════════════════════════════════════ */
.zone-netpanel {
  grid-area: netpanel;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--pad);
  overflow-y: auto;
}

.net-status {
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 6px;
}

.net-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: .8rem;
  padding: 4px 0;
}

.net-kv { display: flex; justify-content: space-between; }

.net-graph {
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 6px;
}

.net-canvas-wrap {
  height: clamp(80px, 12vh, 130px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}
.net-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.net-worldmap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.worldmap-wrap {
  flex: 1;
  min-height: 60px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}
.worldmap-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ══════════════════════════════════════
   Bottom Zone (Filesystem + Terminal)
   ══════════════════════════════════════ */
.zone-bottom {
  grid-area: bottom;
  padding: var(--pad);
}

.bottom-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(460px, 1.5fr);
  gap: var(--gap);
}

.fs-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.fs-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  padding: 6px 2px;
  align-content: start;
}

.fs-status {
  font-size: .72rem;
  padding: 4px 0 0;
  border-top: 1px dashed var(--border);
}

/* ── Footer ── */
.zone-footer {
  grid-area: footer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: .72rem;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* ═══ Responsive ═══ */

@media (max-width: 1399px) {
  .shell {
    grid-template-columns: var(--left-w) 1fr;
    grid-template-areas:
      "header   header"
      "sysmon   desktop"
      "bottom   bottom"
      "footer   footer";
  }
  .zone-netpanel { display: none; }
}

@media (max-width: 1099px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 40px auto 1fr auto 28px;
    grid-template-areas:
      "header"
      "sysmon"
      "desktop"
      "bottom"
      "footer";
  }
  .zone-sysmon {
    max-height: 180px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .sysmon-clock { display: none; }
  .sysmon-procs { display: none; }
  .zone-netpanel { display: none; }
  .bottom-grid { grid-template-columns: 1fr; }
}
