/* =========================================================
   ROOT VARIABLES
   ========================================================= */
:root {
  color-scheme: dark;

  --bg-deep: #0b0b16;
  --bg-mid: #0c1223;
  --bg-accent: #141b33;

  --card: rgba(13, 18, 34, 0.88);
  --card-border: rgba(120, 136, 255, 0.15);

  --text: #f4f5ff;
  --muted: #a3aac4;

  --accent: #7b8bff;
  --accent-2: #35f2d3;

  --warning: #ffb356;
  --danger: #ff6b6b;

  --terminal: #090c15;
  --terminal-border: rgba(109, 120, 190, 0.35);

  --shadow: 0 26px 80px rgba(4, 5, 12, 0.55);
}

/* =========================================================
   RESET
   ========================================================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 20%, rgba(123,139,255,.24), transparent 55%),
    radial-gradient(circle at 90% 10%, rgba(53,242,211,.18), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255,107,107,.15), transparent 45%),
    linear-gradient(140deg, var(--bg-deep), var(--bg-mid) 55%, var(--bg-accent));
}

/* =========================================================
   LAYOUT
   ========================================================= */
.shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* =========================================================
   TOP BAR
   ========================================================= */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 800;
  letter-spacing: 3px;
  padding: 10px 16px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #040712;
  box-shadow: var(--shadow);
}

.brand-text .title {
  font-size: 1.4rem;
  font-weight: 700;
}

.brand-text .subtitle {
  font-size: 0.9rem;
  color: var(--muted);
}

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

.session-user {
  font-size: 0.9rem;
  color: var(--muted);
}

/* =========================================================
   COMMON UI
   ========================================================= */
.card,
.panel,
.status-bar {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

/* =========================================================
   LOGIN
   ========================================================= */
.login-card {
  max-width: 420px;
  padding: 28px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(123,139,255,.3);
  background: rgba(8,12,24,.7);
  color: var(--text);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255,255,255,.08);
  color: var(--text);
}

button.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #040712;
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
}

button.danger {
  background: linear-gradient(135deg, #ff6b6b, #ffb356);
  color: #1a0505;
}

/* =========================================================
   STATUS BAR
   ========================================================= */
.status-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 24px;
}

.status-bar .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.status-bar .value {
  font-size: 1.05rem;
  font-weight: 700;
}

/* =========================================================
   MAIN GRID
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  grid-template-areas:
    "metrics logs"
    "commands output"
    "actions actions"
    "shell shell";
}

[data-area="metrics"]  { grid-area: metrics; }
[data-area="logs"]     { grid-area: logs; }
[data-area="commands"] { grid-area: commands; }
[data-area="output"]   { grid-area: output; }
[data-area="actions"]  { grid-area: actions; }
[data-area="shell"]    { grid-area: shell; }

/* =========================================================
   PANELS
   ========================================================= */
.panel {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel.collapsed .panel-body {
  display: none;
}

/* =========================================================
   METRICS
   ========================================================= */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.metric-card {
  background: rgba(8,12,24,.75);
  border: 1px solid rgba(123,139,255,.25);
  border-radius: 16px;
  padding: 14px;
}

.metric-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

canvas {
  width: 100%;
  height: 70px;
}

/* =========================================================
   LOGS
   ========================================================= */
.log-buttons {
  display: flex;
  gap: 12px;
}

.log-btn {
  height: 38px;
  min-width: 90px;
  border-radius: 10px;
  font-weight: 600;
}

.log-btn.info {
  background: rgba(123,139,255,.25);
}

.log-btn.warn {
  background: rgba(255,179,86,.25);
}

.log-btn.error {
  background: rgba(255,107,107,.25);
}

.logs-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Prevent the logs panel from growing unbounded; become scrollable when large */
  max-height: 420px;
}

.log-entry {
  background: rgba(5,7,18,.88);
  border-radius: 10px;
  padding: 10px;
}

/* =========================================================
   COMMAND OUTPUT
   ========================================================= */
.output {
  flex: 1;
  background: var(--terminal);
  border: 1px solid var(--terminal-border);
  border-radius: 14px;
  padding: 14px;
  font-family: "JetBrains Mono", monospace;
  white-space: pre-wrap;
  overflow: auto;
}

/* =========================================================
   QUICK ACTIONS
   ========================================================= */
.actions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.action-card {
  background: rgba(8,12,24,.75);
  border-radius: 14px;
  padding: 12px;
}

.actions-list {
  gap: 16px; /* more space between cards */
}

.action-card {
  padding: 16px;
  gap: 12px; /* internal spacing */
}

.action-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.action-desc {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Separate the button visually */
.action-card button {
  align-self: flex-start;
  margin-top: 8px;
}

.action-card {
  background: linear-gradient(
    160deg,
    rgba(8,12,24,.85),
    rgba(8,12,24,.65)
  );
}


/* ================================
   ADVANCED SHELL — POWERSHELL STYLE
   ================================ */

.shell-console {
  background: #05070f;
  border: 1px solid rgba(109, 120, 190, 0.35);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

/* OUTPUT AREA */
#shell-output {
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    #05070f;
  background-size: 100% 22px;

  border-radius: 8px;
  padding: 12px;
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;

  color: #e8f0ff;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* INPUT ROW */
.shell-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: #05070f;
  border-radius: 8px;
  border: 1px solid rgba(109, 120, 190, 0.35);
}

/* POWERSHELL PROMPT */
.shell-row .prompt {
  color: #35f2d3;
  font-weight: 700;
  white-space: nowrap;
}

/* INPUT FIELD */
#shell-command {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;

  color: #f4f5ff;
  font-family: inherit;
  font-size: 0.85rem;
}

#shell-command::placeholder {
  color: rgba(232, 240, 255, 0.45);
}

/* ACTION BUTTONS */
.shell-console .button-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "metrics"
      "logs"
      "commands"
      "output"
      "actions"
      "shell";
  }
}
