/* Uncrowed theme — ported from the design/22 mockup (login.html, main.html,
   admin.html, Profile.html, security.html): pure black background, white
   text, Arial, dark-gray pill inputs/buttons, crown wordmark logo, and a
   fixed top-right icon nav instead of a sidebar. */
:root {
  --bg:        #000;
  --panel:     #111;
  --input-bg:  #222;
  --input-bg-2: #333;
  --text:      #fff;
  --text-dim:  #aaa;
  --text-dimmer: #666;
  --border:    #222;
  --danger:    #f00;
  --success:   #0f0;
  --radius:    10px;
  --radius-pill: 50px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* Holds the logo + main content as one flex item, so `.shell`'s
   space-between only ever creates ONE gap (before the footer) instead of
   splitting extra vertical space between "after logo" and "before footer". */
.shell-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ── Logo (crown wordmark) — lives in normal document flow now (NOT
   position:fixed), so it scrolls away with the rest of the page instead of
   staying pinned while the user scrolls down. ── */
.logo-link {
  display: block;
  margin: 70px 0 40px;
  text-decoration: none;
  transition: opacity 0.2s;
}
.logo-link:hover { opacity: 0.8; }
.logo-container { position: relative; display: inline-block; }
.logo { font-size: 1.8em; font-weight: bold; letter-spacing: 0.05em; color: #fff; }
.logo-image { position: absolute; top: -42px; left: 50%; transform: translateX(-50%); width: 56px; height: auto; }

/* ── Left-side icon nav (Configs/Chat/Invites/Help/Profile/Security),
   vertically centered, stacked top to bottom ── */
.side-nav {
  position: fixed;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: var(--text-dim);
  z-index: 20;
}

/* ── Top-right icon nav (Admin/Logout when authenticated, Help/Login for guests) ── */
.top-nav {
  position: fixed;
  top: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--text-dim);
  z-index: 20;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 60%;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.9em;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-item:hover { color: #fff; text-decoration: none; }
.nav-item.active { color: #fff; }
.nav-icon { width: 22px; height: 22px; object-fit: contain; }
.nav-icon-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.logout-btn { background: none; border: none; cursor: pointer; padding: 0; }

/* ── Content ── */
.content { width: 100%; max-width: 640px; padding: 0 24px 60px; text-align: center; }
.content.wide { max-width: 760px; }
.content.narrow { max-width: 400px; }

h1 { font-size: 1.8em; margin: 0 0 10px; }
h2 { font-size: 1.3em; margin: 24px 0 12px; }
p.subtitle { color: var(--text-dim); margin-top: -4px; margin-bottom: 24px; font-size: 0.95em; }

/* ── Panels / cards ── */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  text-align: left;
}
.panel-title { font-weight: bold; margin-bottom: 12px; font-size: 1.1em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat-card { background: var(--input-bg); border-radius: var(--radius); padding: 16px; }
.stat-value { font-size: 1.6em; font-weight: bold; }
.stat-label { color: var(--text-dim); font-size: 0.85em; margin-top: 4px; }

/* ── Forms ── */
form.stacked { display: flex; flex-direction: column; gap: 20px; text-align: left; }
label { font-size: 1.05em; margin-bottom: 8px; display: block; }
input[type=text], input[type=password], input[type=file], input[type=email], textarea, select {
  width: 100%;
  background: var(--input-bg);
  border: none;
  border-radius: var(--radius);
  padding: 12px 15px;
  color: var(--text-dim);
  font: inherit;
  font-size: 1em;
}
input:focus, textarea:focus, select:focus { outline: 1px solid #555; color: #fff; }

button, .btn {
  background: var(--input-bg);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font: inherit;
  font-size: 1.05em;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--input-bg-2); text-decoration: none; }
button.secondary, .btn.secondary { background: var(--input-bg); }
button.danger, .btn.danger { background: #2a1414; color: #ff6b6b; }

/* Full-width gray action button, no arrow (Save changes / Generate Invite
   Code / Send Message style — distinct from the white arrow-suffixed CTA
   used for Login/Create account below). */
button.block, .btn.block { width: 100%; text-align: center; }

/* Primary call-to-action (Login / Create account style) */
button.primary, .btn.primary {
  background: #fff;
  color: #000;
  font-weight: bold;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
button.primary:hover, .btn.primary:hover { background: #eee; }
button.primary::after { content: "→"; font-size: 1.2em; }

/* ── Home hero ── */
.hero { margin-top: 40px; }
.hero h1 { font-size: 2.6em; }
.hero p.subtitle {
  font-size: 1.15em;
  margin-top: 22px;
  margin-bottom: 60px;
}
.btn-outline {
  display: inline-block;
  color: #eee;
  font-size: 1.1em;
  padding: 8px 25px;
  border: 2px solid #fff;
  border-radius: var(--radius-pill);
  background: #111;
  text-decoration: none;
  transition: background 0.2s;
  margin-top: 30px;
}
.btn-outline:hover { background: #222; text-decoration: none; }

/* ── Profile header (avatar + name + badges + meta) ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 22px;
  text-align: left;
  margin-bottom: 20px;
}
.avatar-block { flex-shrink: 0; }
.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--input-bg);
  display: block;
}
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4em;
  font-weight: bold;
  color: #fff;
}
/* Own profile only — the avatar itself is the upload control (click to
   change), with a "Change" label that fades in on hover. */
.avatar-label {
  position: relative;
  display: inline-block;
  border-radius: 50%;
  cursor: pointer;
}
.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.avatar-label:hover .avatar-overlay { opacity: 1; }

.profile-name-line { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.profile-name { font-size: 1.5em; font-weight: bold; }
.profile-you { color: var(--text-dim); font-weight: normal; font-size: 0.65em; }
.profile-invited-by { font-size: 0.85em; color: var(--text-dim); }
.profile-invited-by a { color: #fff; }
.profile-badges { margin: 8px 0 6px; display: flex; gap: 8px; }
.badge.premium { color: #000; background: #fff; }
.badge.beta { color: #0af; background: #0a2a3a; }
.profile-meta { color: var(--text-dim); font-size: 0.9em; margin-top: 2px; }
.uid-value { color: #fff; }
.profile-meta.last-seen { color: var(--text-dim); margin-top: 10px; }

/* ── Profile comments ── */
/* Extra top margin separates it further from the license card above,
   per request ("move comments lower"). */
.comments-panel { margin-top: 40px; }

/* "iOS26" styling: pure black card, thin glowing white border, generous
   rounded corners — distinct from the app's regular flat `.panel` look. */
.comment-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset, 0 4px 16px rgba(0, 0, 0, 0.5);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.comment-item:last-child { margin-bottom: 0; }
.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--input-bg);
  flex-shrink: 0;
  display: block;
}
.comment-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.95em;
  color: #fff;
}
.comment-content { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.comment-author { color: #fff; font-weight: bold; font-size: 0.9em; }
.comment-time { color: var(--text-dimmer); font-size: 0.75em; }
.comment-body { color: var(--text-dim); margin-top: 4px; font-size: 0.9em; white-space: pre-wrap; word-break: break-word; }
.comment-delete {
  background: none;
  border: none;
  color: var(--text-dimmer);
  font-size: 0.75em;
  cursor: pointer;
  padding: 4px 0 0;
  text-decoration: underline;
}
.comment-delete:hover { color: var(--danger); }

/* ── Comments pager (arrows appear once there's more than one page of 5) ── */
.comments-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
}
.comments-pager-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  color: #fff;
  text-decoration: none;
}
.comments-pager-arrow:hover { background: var(--input-bg); text-decoration: none; }
.comments-pager-arrow.disabled { opacity: 0.3; pointer-events: none; }
.comments-pager-label { color: var(--text-dim); font-size: 0.85em; }

/* ── License status card (bottom of Profile) ── */
.license-card {
  position: relative;
  border-radius: var(--radius);
  padding: 34px 24px;
  margin-top: 20px;
  text-align: center;
  overflow: hidden;
  border: 1px solid #222;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.8)),
    radial-gradient(circle at 25% 15%, rgba(255, 140, 0, 0.16), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0px, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 3px),
    linear-gradient(135deg, #1a1a1a 0%, #050505 65%);
}
.license-title {
  font-size: 1.6em;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.license-status { font-size: 1.3em; font-weight: bold; margin-top: 12px; }
.license-status.license-inactive { color: var(--text-dim); font-size: 1.1em; }
.license-sub {
  color: var(--text-dim);
  margin-top: 4px;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.license-card .btn.primary.license-cta { width: auto; display: inline-flex; margin-top: 18px; padding: 10px 24px; }

/* ── Store ── */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.store-card {
  position: relative;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.store-card.featured { border: 1px solid #fff; }
.store-badge {
  position: absolute;
  top: -10px;
  background: #fff;
  color: #000;
  font-size: 0.7em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
}
.store-plan { font-weight: bold; font-size: 1.1em; text-transform: uppercase; letter-spacing: 0.05em; }
.store-product { color: var(--text-dim); font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.06em; }
.store-price { font-size: 1.7em; font-weight: bold; margin-top: 8px; }
.store-price-alt { font-size: 0.5em; color: var(--text-dim); font-weight: normal; }
.store-price-rub { color: var(--text-dim); font-size: 0.95em; }
.store-card .btn.primary.store-buy { width: auto; margin-top: 14px; padding: 10px 22px; }

/* Smaller + pushed further down the page than a regular `.panel` — a
   secondary action, not competing visually with the plan cards above. */
.redeem-panel {
  max-width: 340px;
  margin: 50px auto 0;
  padding: 16px 18px;
  text-align: center;
}
.redeem-panel .panel-title { font-size: 0.95em; margin-bottom: 10px; }

/* ── Download Loader emulation modal ── */
.download-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--input-bg);
  overflow: hidden;
}
.download-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width 0.2s ease-out;
}

.error-box {
  color: var(--danger);
  padding: 10px 0;
  margin-bottom: 14px;
  font-size: 0.95em;
  text-align: center;
}

.terms { margin-top: 24px; color: var(--text-dimmer); font-size: 0.85em; text-align: center; }
.terms a { color: var(--text-dim); text-decoration: underline; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9em; }
th { color: var(--text-dim); font-weight: bold; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8em; font-weight: bold; background: var(--input-bg); }
.badge.admin { color: #f00; background: #2a1414; }
.badge.banned { color: #ff6b6b; background: #2a1414; }
.badge.ok { color: var(--success); background: #0f2a0f; }

/* ── Chat ── */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 60vh;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { font-size: 0.9em; line-height: 1.4; }
.chat-msg .name { color: #fff; font-weight: bold; margin-right: 6px; }
.chat-msg .time { color: var(--text-dimmer); font-size: 0.75em; margin-left: 6px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; }

.changelog-entry { margin-bottom: 18px; }
.changelog-entry .version { font-weight: bold; }
.changelog-entry .date { color: var(--text-dim); font-size: 0.85em; margin-left: 8px; }
.changelog-entry ul { margin: 8px 0 0; padding-left: 20px; color: var(--text-dim); }

.faq-item { margin-bottom: 18px; }
.faq-q { font-weight: bold; margin-bottom: 6px; }
.faq-a { color: var(--text-dim); }

footer {
  text-align: center;
  color: var(--text-dimmer);
  font-size: 0.85em;
  padding: 30px 20px;
  line-height: 1.8;
}
footer a { color: var(--text-dim); text-decoration: underline; }

/* ── Modal (Contacts, etc.) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-title { font-size: 1.2em; font-weight: bold; }
.modal-text { color: var(--text-dim); margin: 0; }
.modal-note { color: var(--text-dimmer); font-size: 0.85em; margin: -6px 0 0; }
