/* Panel Styles (Wild West theme) */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Wild West palette (parchment + wood/leather) */
  --bg: #1b120b;
  --panel: #f3e4c9;
  --panel2: #ead6b4;
  --text: rgba(255, 248, 235, 0.94);
  --muted: rgba(243, 228, 201, 0.78);
  --border: rgba(243, 228, 201, 0.18);
  --accent: #8b2f1f;
  --accent2: #b66a2b;
  --danger: #8b1e24;
  --ok: #2d6a2d;
  --shadow: 0 18px 40px rgba(0,0,0,0.28);
  --radius: 16px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 700px at 20% 10%, rgba(243, 228, 201, 0.22), transparent 60%),
    radial-gradient(700px 520px at 88% 12%, rgba(182, 106, 43, 0.16), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(0,0,0,0.25), transparent 55%),
    linear-gradient(180deg, rgba(60, 34, 18, 0.45), rgba(27, 18, 11, 0.92)),
    var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* Optional background image (place file at src/panel/assets/bg.jpg) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('/assets/bg.jpg') center center / cover no-repeat;
  opacity: 0.58; /* stronger so image is visible */
  filter: saturate(0.86) contrast(1.06) brightness(0.98);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg,
      rgba(27, 18, 11, 0.52) 0%,
      rgba(60, 34, 18, 0.36) 50%,
      rgba(27, 18, 11, 0.52) 100%);
  z-index: -1;
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(64, 40, 24, 0.9), rgba(44, 26, 14, 0.82));
  border-bottom: 1px solid rgba(243, 228, 201, 0.18);
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  max-width: 1100px;
  margin: 0 auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions .avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255, 248, 235, 0.96);
}

.brand-sub {
  color: rgba(243, 228, 201, 0.78);
  font-size: 13px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Common */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-size: 26px;
}

h2 {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-size: 18px;
  margin: 16px 0 10px 0;
  letter-spacing: 0.3px;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 13px;
}

/* Search */
.search-form {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.18);
}

.search-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.help {
  margin-top: 8px;
  font-size: 12px;
}

.input {
  width: min(520px, 78vw);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  outline: none;
}

select.input {
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
}

select.input option,
select.input optgroup {
  background: var(--bg);
  color: var(--text);
}

.input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(64, 40, 24, 0.38));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
  white-space: pre-wrap;
}

.ok {
  color: var(--ok);
  white-space: pre-wrap;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 228, 201, 0.35);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(243, 228, 201, 0.9);
  font-size: 12px;
}

/* Cards */
.card {
  border: 1px solid rgba(243, 228, 201, 0.18);
  background:
    radial-gradient(1100px 520px at 20% 10%, rgba(182, 106, 43, 0.18), transparent 56%),
    radial-gradient(820px 520px at 88% 14%, rgba(139, 47, 31, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,0.30), rgba(0,0,0,0.16));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  backdrop-filter: blur(4px) saturate(1.05);
}

.card-body {
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* Guild list */
.guild-link {
  display: block;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(3px) saturate(1.05);
  backdrop-filter: blur(3px) saturate(1.05);
}

.guild-link:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.guild-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guild-name {
  font-weight: 700;
}

.guild-id {
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: rgba(243, 228, 201, 0.72);
}

/* Avatar */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(64, 40, 24, 0.38);
  background: linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.14));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: rgba(255, 248, 235, 0.9);
  background: linear-gradient(180deg, rgba(182, 106, 43, 0.6), rgba(139, 47, 31, 0.55));
}

/* Ranch member tiles (ranch breakdown) */
.member-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-header {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.member-text {
  min-width: 0;
}

.member-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-id code {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.member-stats {
  display: grid;
  gap: 6px;
  justify-items: start;
  text-align: left;
  min-width: 0;
  max-width: 100%;
}

.member-stats .stat-line {
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  gap: 8px;
  max-width: 100%;
  align-items: baseline;
  min-width: 0;
  color: var(--muted);
}

.member-stats .stat-icon {
  width: 18px;
}
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
.member-stats .stat-label {
  white-space: normal;
}

.member-stats .stat-value {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.nowrap {
  white-space: nowrap;
}

.member-stats .stat-total {
  font-weight: 800;
  color: rgba(255, 248, 235, 0.94);
}

/* Form */
textarea {
  width: 100%;
  min-height: 520px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.028),
      rgba(0,0,0,0.028) 2px,
      rgba(0,0,0,0.0) 2px,
      rgba(0,0,0,0.0) 26px
    ),
    rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(243, 228, 201, 0.22);
  border-radius: 12px;
  padding: 12px;
  outline: none;
}

textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(64, 40, 24, 0.38));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button {
  appearance: none;
  border: 1px solid rgba(42, 26, 16, 0.35);
  background:
    linear-gradient(180deg, rgba(182, 106, 43, 0.55), rgba(139, 47, 31, 0.55)),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
  color: rgba(255, 248, 235, 0.96);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.03);
}

/* Button system (panel-style) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  border: 1px solid rgba(42, 26, 16, 0.35);
  background: rgba(0, 0, 0, 0.10);
  color: rgba(255, 248, 235, 0.96);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.2px;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.03);
}

.btn-primary {
  background:
    linear-gradient(180deg, rgba(182, 106, 43, 0.55), rgba(139, 47, 31, 0.55)),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(243, 228, 201, 0.28);
  color: rgba(243, 228, 201, 0.92);
}

.btn-danger {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--danger) 62%, rgba(0,0,0,0.18)), rgba(0,0,0,0.24)),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
  border: 1px solid rgba(243, 228, 201, 0.22);
  color: rgba(255, 248, 235, 0.96);
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(243, 228, 201, 0.28);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(243, 228, 201, 0.92);
}

.backlink:hover {
  text-decoration: none;
  border-color: rgba(243, 228, 201, 0.5);
}

.footer-note {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(243, 228, 201, 0.7);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
