/* ─── Omega Reborn · FFXI Private Server ─────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ─── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg-base:       #0c0e12;
  --bg-surface:    #111418;
  --bg-raised:     #181c22;
  --bg-border:     #222830;
  --gold:          #c8962a;
  --gold-light:    #e8b84b;
  --gold-dim:      #6b4f14;
  --teal:          #2a8a8a;
  --teal-light:    #3ab0b0;
  --red:           #b33f54;
  --green:         #3a9e5f;
  --text-primary:  #dde2e8;
  --text-secondary:#7a8494;
  --text-dim:      #454d5a;
  --font-display:  'Cinzel', Georgia, serif;
  --font-body:     'Inter', system-ui, sans-serif;
  --radius:        4px;
  --sidebar-w:     210px;
}

/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
}

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: #fff; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--bg-border);
}

.sidebar-logo a {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  text-transform: uppercase;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 3px;
  display: block;
}

.sidebar-logo img {
  width: 90px;
  display: block;
  margin-bottom: 8px;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
}

.nav-list li a:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.nav-list li a.active,
.nav-list li a:focus {
  color: var(--gold-light);
  background: rgba(200, 150, 42, 0.08);
  border-right: 2px solid var(--gold);
}

.nav-list .feather {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.nav-list li a:hover .feather,
.nav-list li a.active .feather {
  color: inherit;
}

.nav-divider {
  height: 1px;
  background: var(--bg-border);
  margin: 8px 20px;
}

/* ─── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 48px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px;
  gap: 8px;
  z-index: 90;
}

.topbar .username {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: 48px;
  padding: 28px 32px;
  min-height: calc(100vh - 48px);
  width: calc(100% - var(--sidebar-w));
  max-width: 1600px;
  box-sizing: border-box;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  overflow-wrap: break-word;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-border);
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  line-height: 1;
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; }
.btn:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-secondary {
  background: var(--gold);
  color: #0c0e12;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-dim);
  opacity: 1;
}

.btn-link {
  background: transparent;
  color: var(--text-secondary);
  padding: 0 8px;
}

.btn-link:hover { color: var(--text-primary); opacity: 1; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(200, 150, 42, 0.15);
}

.form-control::placeholder { color: var(--text-dim); }

.form-control:disabled {
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--bg-border);
  text-align: left;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(34,40,48,0.6);
  color: var(--text-primary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-raised); }

/* ─── Player / Job ────────────────────────────────────────────────────────── */
.player-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.player-job  { font-size: 11px; color: var(--text-secondary); }

.job-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  color: var(--text-secondary);
}

.online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  margin-right: 5px;
}

/* ─── Chat / Yells ────────────────────────────────────────────────────────── */
.chat-messages {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-line { line-height: 1.5; }
.chat-date { color: var(--text-dim); margin-right: 5px; font-size: 11px; }
.chat-speaker { color: var(--gold-light); margin-right: 4px; font-weight: 500; }
.chat-message { color: var(--text-secondary); }

.chat-at-start { color: var(--green); font-weight: 700; }
.chat-at-end   { color: var(--red);   font-weight: 700; }

/* ─── Armor grid ──────────────────────────────────────────────────────────── */
#armor { border-collapse: separate; border-spacing: 4px; }
#armor td { padding: 3px; }
.armor-slot { width: 32px; height: 32px; background-color: var(--bg-raised); border: 1px solid var(--bg-border); }

#job-levels, #craft-levels, #mission-ranks {
  border-collapse: separate;
  border-spacing: 4px 6px;
  color: var(--text-primary);
}

#job-levels td, #craft-levels td, #mission-ranks td { font-size: 14px; }

.job-level-name, .craft-level-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.job-level-name { width: 38px; }
.craft-level-name { width: 104px; }

.job-level-level, .craft-level-level, .mission-rank-rank {
  width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding-right: 4px !important;
}

/* ─── Auth pages ──────────────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 20px;
}

.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 32px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold-light);
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.auth-tagline {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-border);
}

.auth-links {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-alert-error {
  background: rgba(179, 63, 84, 0.12);
  border: 1px solid rgba(179, 63, 84, 0.35);
  color: #e28598;
}

.auth-alert-success {
  background: rgba(58, 158, 95, 0.12);
  border: 1px solid rgba(58, 158, 95, 0.35);
  color: #7bd19c;
}

/* ─── Online status badge ─────────────────────────────────────────────────── */
.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(58, 158, 95, 0.1);
  border: 1px solid rgba(58, 158, 95, 0.3);
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.online-badge:hover {
  background: rgba(58, 158, 95, 0.18);
  border-color: rgba(58, 158, 95, 0.5);
}

.online-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: online-pulse 2s ease-out infinite;
}

.online-badge-count {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 13px;
}

@keyframes online-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(58, 158, 95, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(58, 158, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(58, 158, 95, 0); }
}

.form-control.field-error {
  border-color: var(--red) !important;
}

/* ─── Misc helpers ────────────────────────────────────────────────────────── */
.text-gold    { color: var(--gold-light); }
.text-teal    { color: var(--teal-light); }
.text-red     { color: var(--red); }
.text-green   { color: var(--green); }
.text-muted   { color: var(--text-secondary); }
.text-dim     { color: var(--text-dim); }

.red   { color: var(--red); }
.yellow{ color: var(--gold-light); }
.blue  { color: var(--teal-light); }
.green { color: var(--green); }

.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.divider {
  height: 1px;
  background: var(--bg-border);
  margin: 16px 0;
}

.footer-notice {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 20px 0 8px;
}

/* ─── Transactions ────────────────────────────────────────────────────────── */
#transactions-table { font-size: 12px; }
#transactions-table td { padding: 4px 6px; }
.tx-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
}

.tx-list {
  display: flex;
  flex-direction: column;
}

.tx-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-border);
}

.tx-row:last-child { border-bottom: none; }

.tx-date {
  color: var(--text-dim);
  font-size: 11px;
  width: 72px;
  flex-shrink: 0;
}

.tx-parties {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.tx-player { color: var(--teal-light); }
.tx-item { color: var(--gold-light); }

.tx-stack-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 1px 6px;
}

.tx-arrow {
  color: var(--text-dim);
  display: inline-flex;
  flex-shrink: 0;
}
.tx-arrow svg { width: 12px; height: 12px; }

.tx-price {
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 10px;
}

/* ─── Tickets ─────────────────────────────────────────────────────────────── */
.ticket-table-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 8px 22px;
  border-bottom: 1px solid var(--bg-border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.ticket-col-id { width: 42px; flex-shrink: 0; }
.ticket-col-date { width: 96px; flex-shrink: 0; }
.ticket-col-char { flex: 1; min-width: 0; }
.ticket-col-status { width: 90px; flex-shrink: 0; text-align: right; }
.ticket-col-assigned { width: 140px; flex-shrink: 0; text-align: right; }

.ticket-row {
  border-bottom: 1px solid var(--bg-border);
}

.ticket-row:last-child { border-bottom: none; }

.ticket-row-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.ticket-row-summary::-webkit-details-marker { display: none; }
.ticket-row-summary::marker { content: ''; }

.ticket-row-summary::before {
  content: '▸';
  display: inline-block;
  color: var(--text-secondary);
  font-size: 16px;
  width: 16px;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.ticket-row-summary:hover::before {
  color: var(--gold-light);
}

.ticket-row-summary:hover {
  background: var(--bg-raised);
}

.ticket-row[open] > .ticket-row-summary::before {
  transform: rotate(90deg);
}

.ticket-char { color: var(--teal-light); font-weight: 600; text-decoration: none; }

.ticket-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
}

.ticket-status-pending {
  background: rgba(200, 150, 42, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(200, 150, 42, 0.35);
}

.ticket-status-answered {
  background: rgba(58, 158, 95, 0.12);
  border: 1px solid rgba(58, 158, 95, 0.35);
  color: #7bd19c;
}

.ticket-row-detail {
  padding: 0 0 14px 22px;
}

.ticket-message {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.ticket-response {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.ticket-response-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.ticket-reply-form { margin-top: 10px; }
.ticket-reply-form textarea { resize: vertical; }

.ticket-assigned-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-light);
}

.ticket-sort-link {
  color: var(--text-dim) !important;
}

.ticket-sort-active {
  color: var(--gold-light) !important;
  font-weight: 600;
}

.ticket-unassigned-badge {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

.ticket-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-border);
}

.ticket-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.ticket-inline-form textarea,
.ticket-inline-form select {
  width: 100%;
}

.ticket-inline-form select { max-width: 260px; }

.ticket-notes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.ticket-note {
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
}

.ticket-note-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.ticket-note-author { color: var(--gold-light); font-weight: 600; }

.ticket-note-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Mobile ──────────────────────────────────────────────────────────────── */
.mobile-menu { display: none !important; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .topbar  { left: 0; }
  .main-content { margin-left: 0; width: 100%; }
  .mobile-menu { display: flex !important; }
}
