/*
 * drwncvnt platform — shared design system
 * An "improved Windows XP / classic Paint" UI theme, used by the gateway hub,
 * the account pages, and every tool module so the whole product looks like one
 * application instead of four different apps behind one login.
 *
 * This file is served once by the gateway at /shared/xp.css and referenced by
 * every module with <link rel="stylesheet" href="/shared/xp.css">. Keep module
 * specific styles in the module's own stylesheet; keep reusable chrome here.
 */

:root {
  /* Surface / bevel palette (classic 3D control look) */
  --face: #c0c0c0;
  --face-light: #dfdfdf;
  --face-dark: #808080;
  --highlight: #ffffff;
  --shadow: #404040;

  /* Accents */
  --titlebar-from: #0a246a;
  --titlebar-to: #a6caf0;
  --titlebar-text: #ffffff;
  --accent: #000080;
  --field-bg: #ffffff;
  --danger: #a80000;

  /* Desktop backdrop */
  --desktop: #245edb; /* the classic XP "Bliss" blue, calmer than #008080 */

  /* Spacing scale — consistent rhythm across every module */
  --sp-1: 4px;
  --sp-2: 6px;
  --sp-3: 8px;
  --sp-4: 12px;
  --sp-5: 16px;
  --sp-6: 24px;

  --font-ui: Tahoma, "MS Sans Serif", Geneva, sans-serif;
  --fs: 11px;
  --fs-title: 12px;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--desktop);
  color: #000000;
  font-family: var(--font-ui);
  font-size: var(--fs);
}

/* ------------------------------------------------------------------ *
 * Window chrome
 * ------------------------------------------------------------------ */
.window {
  display: flex;
  flex-direction: column;
  background: var(--face);
  border: 2px outset var(--face);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
}

/* Fills the whole viewport — used by full-screen tools like the editor. */
.window--full {
  height: 100vh;
  box-shadow: none;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px var(--sp-1);
  background: linear-gradient(90deg, var(--titlebar-from), var(--titlebar-to));
  color: var(--titlebar-text);
  font-weight: bold;
  font-size: var(--fs-title);
}

.titlebar-icon {
  width: 14px;
  height: 14px;
  background: var(--face);
  border: 1px solid #000000;
  flex-shrink: 0;
}

.titlebar-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-buttons {
  display: flex;
  gap: 2px;
}

.win-btn {
  width: 16px;
  height: 14px;
  background: var(--face);
  border: 1px outset var(--face);
  font-family: Marlett, Tahoma, sans-serif;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  color: #000000;
  cursor: default;
}
.win-btn:active {
  border-style: inset;
}
.win-btn-close {
  font-weight: bold;
}

/* Menu bar (File / Edit / ...) */
.menubar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: var(--face);
  border-bottom: 1px solid var(--face-dark);
  padding: 2px var(--sp-2);
}
.menubar span {
  cursor: default;
  padding: 1px 4px;
}
.menubar span:hover {
  background: var(--accent);
  color: #ffffff;
}

/* Status bar */
.statusbar {
  display: flex;
  align-items: center;
  padding: 3px var(--sp-2);
  background: var(--face);
  border-top: 1px solid var(--highlight);
  font-size: var(--fs);
}
.statusbar .status-field {
  border: 1px inset var(--face);
  padding: 2px var(--sp-2);
  flex: 1;
}
.status-link {
  border: 1px inset var(--face);
  padding: 2px var(--sp-2);
  margin-left: var(--sp-1);
  color: #000000;
  text-decoration: none;
  white-space: nowrap;
}
.status-link:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 * Buttons
 * ------------------------------------------------------------------ */
.btn {
  background: var(--face);
  color: #000000;
  border: 2px outset var(--face);
  padding: 4px 10px;
  cursor: default;
  font-family: inherit;
  font-size: var(--fs);
}
.btn:active:not(:disabled) {
  border-style: inset;
  padding: 5px 9px 3px 11px;
}
.btn:focus-visible {
  outline: 1px dotted #000000;
  outline-offset: -4px;
}
.btn:disabled {
  color: var(--face-dark);
  text-shadow: 1px 1px 0 var(--highlight);
  cursor: default;
}
.btn.small {
  padding: 2px 8px;
}
.btn.small:active:not(:disabled) {
  padding: 3px 7px 1px 9px;
}
.btn.block {
  display: block;
  width: 100%;
}
/* Default/primary button gets a bold label (classic "focused default" cue). */
.btn.primary {
  font-weight: bold;
}

/* ------------------------------------------------------------------ *
 * Form fields
 * ------------------------------------------------------------------ */
.field-label {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: var(--fs);
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 3px var(--sp-1);
  background: var(--field-bg);
  color: #000000;
  border: 1px inset var(--face);
  font-family: inherit;
  font-size: var(--fs);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px dotted var(--accent);
  outline-offset: 1px;
}

/* Classic checkbox rendered as an inset tick box. */
.switch {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: default;
}
.switch span {
  position: absolute;
  inset: 0;
  background: var(--field-bg);
  border: 1px inset var(--face);
}
.switch span::after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 8px;
  border-bottom: 2px solid #000000;
  border-right: 2px solid #000000;
  transform: rotate(40deg);
}
.switch input:checked + span::after {
  display: block;
}

/* ------------------------------------------------------------------ *
 * Grouping frame (the sunken "groupbox" look)
 * ------------------------------------------------------------------ */
.groupbox {
  border: 2px groove var(--face);
  background: var(--face);
  padding: var(--sp-3);
}
.groupbox > .groupbox-title {
  font-weight: bold;
  margin-bottom: var(--sp-2);
}

/* ------------------------------------------------------------------ *
 * Dialogs / modal overlays (login, register, confirmations)
 * ------------------------------------------------------------------ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  z-index: 100;
}
.dialog {
  width: 300px;
  max-width: 100%;
}
.dialog .dialog-body {
  padding: var(--sp-4);
}
.dialog .field {
  margin-bottom: var(--sp-3);
}
.dialog-error {
  color: var(--danger);
  font-size: var(--fs);
  margin: 0 0 var(--sp-3);
  min-height: 13px;
}
.dialog-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-1);
}
.dialog-switch {
  text-align: center;
  margin-top: var(--sp-4);
  font-size: var(--fs);
}
.dialog-switch a,
a.link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

/* Small helper text. */
.hint {
  font-size: 10px;
  line-height: 1.4;
  margin: 0;
  color: #303030;
}

/* Pill badge, e.g. plan indicator. */
.badge {
  display: inline-block;
  padding: 1px var(--sp-2);
  border: 1px solid var(--face-dark);
  background: var(--face-light);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge.badge-pro {
  background: #fff4c2;
  border-color: #b89500;
}

/* ------------------------------------------------------------------ *
 * Hub / launcher grid (the dashboard of tool "icons")
 * ------------------------------------------------------------------ */
.hub {
  max-width: 720px;
  margin: var(--sp-6) auto;
  padding: 0 var(--sp-4);
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-4);
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3);
  background: var(--face);
  border: 2px outset var(--face);
  color: #000000;
  text-decoration: none;
  text-align: center;
  cursor: default;
}
.tile:hover {
  background: var(--face-light);
}
.tile:active {
  border-style: inset;
}
.tile:focus-visible {
  outline: 1px dotted var(--accent);
  outline-offset: 2px;
}
.tile .tile-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--face-dark);
  background: var(--field-bg);
  font-size: 24px;
  line-height: 1;
}
.tile .tile-name {
  font-weight: bold;
}
.tile .tile-desc {
  font-size: 10px;
  color: #303030;
}
.tile.tile-disabled {
  opacity: 0.6;
}

@media (max-width: 640px) {
  .hub {
    margin: var(--sp-3) auto;
  }
}
