@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --orange:      #E85D1A;
  --orange-hover:#C94A0F;
  --orange-soft: #FDF0EB;
  --black:       #1A1A1A;
  --surface:     #FFFFFF;
  --bg:          #F5F2EE;
  --border:      #E2DDD7;
  --text:        #1A1A1A;
  --muted:       #7A736D;
  --danger:      #CC3333;
  --success-bg:  #F5F2EE;
  --radius:      3px;
}

[data-theme="dark"] {
  --orange:      #F4723A;
  --orange-hover:#E85D1A;
  --orange-soft: #2A1A0F;
  --black:       #F0EDE8;
  --surface:     #1E1C1A;
  --bg:          #151312;
  --border:      #2E2B27;
  --text:        #E8E4DF;
  --muted:       #7A736D;
  --danger:      #E05555;
  --success-bg:  #0F1F14;
}

/* ── Dark mode toggle ────────────────────────────────────── */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  width: 36px;
  height: 20px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
}

.dark-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}

[data-theme="dark"] .dark-toggle {
  background: var(--orange);
  border-color: var(--orange);
}

[data-theme="dark"] .dark-toggle::after {
  background: #fff;
  transform: translateX(16px);
}

/* icon labels inside toggle */
.dark-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dark-toggle-icon {
  font-size: 0.85rem;
  line-height: 1;
  user-select: none;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ─────────────────────────────────────────────── */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.75rem 2.5rem 2.5rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--orange);
  border-radius: var(--radius) 0 0 var(--radius);
}

/* ── Brand ───────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2.25rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--black);
}

.brand-name span { color: var(--orange); }

/* ── Headings ────────────────────────────────────────────── */
h1 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--black);
  margin-bottom: 0.5rem;
}

h1 .accent { color: var(--orange); }

.subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* ── Discord Button ──────────────────────────────────────── */
.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-discord:hover {
  background: var(--orange-hover);
  box-shadow: 0 2px 12px rgba(232, 93, 26, 0.25);
}

.btn-discord:active { background: #B5430E; }

.btn-discord svg {
  width: 20px; height: 20px;
  flex-shrink: 0; fill: #fff;
}

/* ── Primary Button ──────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.btn-primary:hover {
  background: var(--orange-hover);
  box-shadow: 0 2px 12px rgba(232, 93, 26, 0.22);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary.btn-sm {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
}

/* ── Ghost Button ────────────────────────────────────────── */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Logout Button ───────────────────────────────────────── */
.btn-logout {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.12s, color 0.12s;
}

.btn-logout:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Input ───────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.mc-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', monospace;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mc-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232, 93, 26, 0.12);
}

.mc-textarea {
  resize: vertical;
  min-height: 72px;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Note ────────────────────────────────────────────────── */
.note {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  margin-top: 1.5rem;
  line-height: 1.55;
}

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

/* ── Status badge ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--orange-soft);
  border: 1px solid rgba(232, 93, 26, 0.25);
  color: var(--orange);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  margin-bottom: 0.5rem;
}

.status-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ── Step icon (Minecraft link page) ─────────────────────── */
.step-icon {
  width: 48px; height: 48px;
  background: var(--orange-soft);
  border: 1.5px solid var(--orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 1.25rem;
}

.step-icon svg {
  width: 22px; height: 22px;
  stroke: var(--orange);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Errors / Success boxes ──────────────────────────────── */
.error-box {
  background: rgba(204, 51, 51, 0.08);
  border: 1px solid rgba(204, 51, 51, 0.25);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-size: 0.83rem;
  margin-top: 1rem;
  display: none;
  line-height: 1.5;
}

.error-box.visible { display: block; }

.success-box {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: #22c55e;
  font-size: 0.83rem;
  margin-top: 1rem;
  display: none;
  line-height: 1.5;
}

.success-box.visible { display: block; }

/* ── Top Nav ─────────────────────────────────────────────── */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-sm-wrap {
  width: 28px; height: 28px;
  flex-shrink: 0;
}

.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--orange);
  object-fit: cover;
  display: block;
}

.nav-username {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text);
}

/* ── Dashboard layout ────────────────────────────────────── */
.dash-page {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Dashboard header ────────────────────────────────────── */
.dash-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
}

.dash-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--orange);
}

.dash-avatar-wrap {
  flex-shrink: 0;
}

.dash-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2.5px solid var(--orange);
  object-fit: cover;
  display: block;
}

.dash-user-info {
  display: flex;
  flex-direction: column;
}

.dash-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.dash-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.meta-sep {
  color: var(--border);
  font-size: 0.75rem;
}

.mc-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.1rem 0.4rem;
  font-size: 0.77rem;
  color: var(--text);
}

/* ── Dashboard section ───────────────────────────────────── */
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
}

/* ── Corporation list ────────────────────────────────────── */
.corp-list {
  display: flex;
  flex-direction: column;
}

.corp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  gap: 0.25rem;
}

.corp-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  gap: 1rem;
}

.corp-card:last-child { border-bottom: none; }
.corp-card:hover { background: var(--bg); }

.corp-card-body {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  flex: 1;
  min-width: 0;
}

.corp-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.corp-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.corp-card-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.corp-card-date {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
  opacity: 0.7;
}

.btn-delete {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  display: flex;
  align-items: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.btn-delete:hover {
  background: rgba(204, 51, 51, 0.1);
  border-color: rgba(204,51,51,0.2);
  color: var(--danger);
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14);
  position: relative;
  transform: translateY(8px);
  transition: transform 0.18s ease;
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

.modal-close:hover { color: var(--text); }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-actions .btn-primary {
  width: auto;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.73rem;
  letter-spacing: 0.02em;
}

footer span { color: var(--orange); }

/* ── Focus ───────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 2rem 1.5rem 2rem 1.75rem; }
  h1 { font-size: 1.5rem; }
  .topnav { padding: 0 1rem; }
  .dash-page { padding: 1.25rem 1rem; }
  .dash-header { padding: 1.25rem; gap: 1rem; }
  .dash-avatar { width: 48px; height: 48px; }
  .section-header { padding: 0.9rem 1rem; }
  .corp-card { padding: 0.9rem 1rem; }
  .corp-card-desc { max-width: 200px; }
  .nav-username { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Corp card actions (manage + delete) ─────────────────── */
.corp-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-manage {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid rgba(232, 93, 26, 0.25);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}

.btn-manage:hover {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 93, 26, 0.2);
}

@media (max-width: 600px) {
  .btn-manage span { display: none; }
}