/* ============================================================
   Fun Color — Shared App Styles
   Brand: violet→pink gradient on dark (#0f0a1e)
   Used by: index.html, login.html, set-password.html, app.html, settings.html
   ============================================================ */

:root {
  --violet: #7c3aed;
  --pink: #ec4899;
  --bg: #0f0a1e;
  --bg-2: #1a1238;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #f1f0f7;
  --muted: #a29fc0;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  --radius-lg: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
}

body {
  font-family: 'Comic Sans MS', 'Comic Sans', 'Comic Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 20% 0%, #2a1a52 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* === Typography === */
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: clamp(24px, 6vw, 36px); }
h2 { font-size: clamp(20px, 5vw, 28px); }
h3 { font-size: 16px; }

/* === Layout containers === */
.page {
  min-height: 100dvh;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  max-width: 600px;
  margin: 0 auto;
}

.page-wide {
  min-height: 100dvh;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  max-width: 900px;
  margin: 0 auto;
}

/* === Brand logo/wordmark === */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand .logo-emoji { font-size: 28px; }
.brand .wordmark {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--violet), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* === Cards === */
.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-tight { padding: 14px; }

/* === Forms === */
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
input:focus {
  border-color: var(--violet);
  background: rgba(255, 255, 255, 0.08);
}
input::placeholder { color: var(--muted); opacity: 0.7; }

/* === Password field wrapper with Show/Hide toggle === */
.pwd-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}
.pwd-wrap input {
  margin-bottom: 0;
  padding-right: 64px;
}
.pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 8px;
  cursor: pointer;
  min-width: 52px;
  text-align: center;
  line-height: 1.2;
  font-family: inherit;
  transition: all 0.15s ease;
  user-select: none;
}
.pwd-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.16);
}
.pwd-toggle:active {
  transform: translateY(-50%) scale(0.94);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, opacity 0.15s;
  min-height: 48px;
  width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #f87171);
}
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
  width: auto;
}
.btn-block { width: 100%; }

/* === Top bar === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 12px;
}
.topbar .left,
.topbar .right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar h2 { font-size: 18px; }

/* === Pills / badges === */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.pill-active { background: rgba(52, 211, 153, 0.18); color: var(--good); }
.pill-revoked { background: rgba(248, 113, 113, 0.18); color: var(--bad); }
.pill-pending { background: rgba(251, 191, 36, 0.18); color: var(--warn); }
.pill-expired { background: rgba(251, 191, 36, 0.18); color: var(--warn); }

/* === Messages === */
.msg {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 18px;
}
.msg-error { color: var(--bad); }
.msg-success { color: var(--good); }
.msg-info { color: var(--muted); }

/* === Links === */
a { color: var(--pink); }
a.link-muted { color: var(--muted); text-decoration: none; font-size: 13px; }
a.link-muted:hover { color: var(--text); }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 8px; font-size: 18px; }
.modal p { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.5; }

/* === Device list (for kick flow) === */
.device-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.device-item:hover, .device-item:active {
  background: rgba(255, 255, 255, 0.1);
}
.device-item .info { flex: 1; min-width: 0; }
.device-item .name { font-size: 14px; font-weight: 600; }
.device-item .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.device-item .kick-icon { font-size: 20px; }

/* === Toast === */
#toast-container {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 90vw;
}
.fc-toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--bg-2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: auto;
}
.fc-toast-info { border-left: 3px solid var(--violet); }
.fc-toast-success { border-left: 3px solid var(--good); }
.fc-toast-error { border-left: 3px solid var(--bad); }
.fc-toast-warn { border-left: 3px solid var(--warn); }
.fc-toast-out { opacity: 0; transform: translateY(-10px); }

/* === Loading spinner === */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fc-spin 0.7s linear infinite;
}
@keyframes fc-spin { to { transform: rotate(360deg); } }

/* === Utility === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-small { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
