/* Oracle dashboard - dark purple theme (Misu palette + logo #8B7BFF) */
:root {
  --bg: #0d0d14;
  --bg-2: #13131f;
  --panel: #17172440;
  --panel-solid: #171724;
  --panel-2: #1e1e30;
  --border: #26263c;
  --text: #f0f0f5;
  --muted: #9090b0;
  --primary: #8e63f3;
  --primary-2: #8b7bff;
  --accent: #7a53e0;
  --success: #4caf50;
  --danger: #f0555c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --transition: .2s ease;
}

* { box-sizing: border-box; }

/* Ensure [hidden] always wins over explicit display rules (e.g. .card-grid uses
   display:grid, which would otherwise override the browser default). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(142,99,243,.14), transparent 55%),
    radial-gradient(700px 500px at 10% 110%, rgba(122,83,224,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-2); text-decoration: none; transition: color var(--transition); }
a:hover { color: #a99bff; }

/* --- top nav --- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 30px; background: rgba(13,13,20,.7); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.nav .brand { display: flex; align-items: center; gap: 0; font-size: 1.2rem; font-weight: 600; color: var(--text); letter-spacing: .2px; }
.nav .brand img { width: 60px; height: 60px; margin-right: -8px; }
.nav .links { display: flex; align-items: center; gap: 20px; font-size: .9rem; color: var(--muted); }
.nav .links .avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; border: 1px solid var(--border); }
.nav .links > span { color: var(--text); }

.container { max-width: 1140px; margin: 0 auto; padding: 32px 28px; }

h1 { font-size: 1.85rem; font-weight: 600; margin: 0 0 6px; letter-spacing: -.3px; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.muted { color: var(--muted); }

/* --- panels & cards --- */
.panel {
  background: linear-gradient(180deg, rgba(30,30,48,.5), rgba(23,23,36,.5));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 22px;
  box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.panel h2 { margin-top: 0; border-bottom: 1px solid var(--border); padding-bottom: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card-tile {
  background: linear-gradient(160deg, var(--panel-2), var(--panel-solid));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: block;
  color: var(--text); transition: transform var(--transition), border-color var(--transition);
}
.card-tile:hover { transform: translateY(-3px); border-color: var(--primary); color: var(--text); }
.card-tile .big { font-size: 1.25rem; font-weight: 600; }
.card-tile .value { font-size: 1.7rem; font-weight: 700; color: var(--primary-2); }

/* --- tables --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; }
tr:hover td { background: rgba(142,99,243,.05); }

/* Wide editor tables (rarities, drops, cards list) scroll sideways within their
   panel at any width instead of wrapping their controls or overflowing the page. */
.table-wrap, .view-list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: max-content; }

/* Rarities edit row: one tidy line (scrolls with the table if space is tight).
   `form.inline.rarity-edit` (specificity 0,2,1) must beat `form.inline`'s
   flex-wrap:wrap (0,1,1), otherwise Save wraps below the fields. */
form.inline.rarity-edit { flex-wrap: nowrap; align-items: center; }
.rarity-edit input { padding: 8px 10px; }
.rarity-edit .fld-weight { width: 68px; }
.rarity-edit .fld-rename { width: 116px; }
.rarity-edit .fld-colour { width: 100px; }
.rarity-edit .fld-burn   { width: 104px; }
.rarity-edit button { flex: none; }

/* --- forms --- */
input, select, button, textarea {
  font: inherit; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); padding: 9px 12px; transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder { color: #5c5c78; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(142,99,243,.18); }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }

/* sleek buttons: flat, refined, subtle */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff; border: 1px solid transparent;
  font-weight: 500; font-size: .92rem; cursor: pointer; padding: 9px 18px;
  border-radius: var(--radius-sm); transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: 0 2px 10px rgba(142,99,243,.25);
}
button:hover, .btn:hover { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(142,99,243,.4); }
button:active, .btn:active { background: #6d47cc; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); box-shadow: none; }
button.secondary:hover { background: var(--panel-2); border-color: var(--primary); }
button.danger { background: transparent; color: var(--danger); border-color: rgba(240,85,92,.4); box-shadow: none; }
button.danger:hover { background: rgba(240,85,92,.14); border-color: var(--danger); }

/* Burn: a subtle warm tint so it reads apart from the primary Sell button. */
button.btn-burn, .btn-burn {
  background: rgba(255,152,0,.14); color: #ffb74d; border-color: rgba(255,152,0,.4); box-shadow: none;
}
button.btn-burn:hover, .btn-burn:hover {
  background: rgba(255,152,0,.24); border-color: #ff9800; color: #ffb74d; box-shadow: none;
}

/* Number inputs: the native spin arrows render with a light default chrome that
   clashes with the dark theme, so hide them. Values remain typeable and can
   still be stepped with the keyboard arrow keys. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }

/* Back button (Premium / Donate -> settings) */
.back-btn { padding: 7px 14px; font-size: .85rem; margin-bottom: 18px; }
.back-btn svg { width: 16px; height: 16px; }

/* Radios: tint to the brand colour. */
input[type="radio"] {
  appearance: auto; -webkit-appearance: auto; accent-color: var(--primary);
  width: 16px; height: 16px; padding: 0; margin: 0 6px 0 0;
  background: none; border: none; box-shadow: none; vertical-align: middle; cursor: pointer;
}

/* Checkboxes: fully custom so both the empty and checked states match the dark
   theme (the native empty box renders as a pale/white square otherwise). */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 18px; height: 18px; margin: 0; padding: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px;
  position: relative; cursor: pointer; vertical-align: middle;
  transition: background var(--transition), border-color var(--transition);
}
input[type="checkbox"]:hover { border-color: var(--primary); }
input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 5px; top: 2px;
  width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(142,99,243,.25); }

/* Reusable labelled checkbox row */
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; cursor: pointer; }

/* Set management list (Sets tab) */
.set-item {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 10px; margin-top: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.set-item .set-info { flex: 1; min-width: 0; }
.set-item .set-name { font-weight: 600; color: var(--text); margin-bottom: 8px; }
.set-item .check-row { align-items: flex-start; }
.set-item button { flex: none; }

/* Footer */
.site-footer {
  max-width: 1140px; margin: 10px auto 30px; padding: 18px 28px;
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: center;
  border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--primary-2); }

/* Legal pages (Terms / Privacy) */
.legal h2 { margin: 22px 0 8px; border: none; padding: 0; font-size: 1.02rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.legal h2:first-child { margin-top: 0; }
.legal p, .legal li { color: var(--muted); }
.legal ul { margin: 6px 0; padding-left: 20px; }
.legal li { margin: 4px 0; }

/* List / grid view toggle */
.view-toggle { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 14px; }
.view-toggle button { padding: 6px 14px; font-size: .85rem; }
.view-toggle button.active {
  background: var(--primary); color: #fff; border-color: transparent;
  box-shadow: 0 2px 10px rgba(142,99,243,.25);
}

/* Image card grid (collection + marketplace) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }

/* Compact variant (Cards management): smaller tiles so a big library doesn't clog
   the page, capped to a scrollable area when there are many cards. */
.card-grid-sm { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
.card-grid-sm .mc-name { font-size: .82rem; margin-top: 6px; }
.card-grid-sm .mc-meta { font-size: .72rem; }
.cards-scroll { max-height: 560px; overflow-y: auto; padding: 2px 4px 2px 2px; }

/* Card edit row (Cards list view): one line, scrolls with .view-list if tight.
   Compound selector beats `form.inline`'s flex-wrap:wrap (see rarity-edit note). */
form.inline.card-edit { flex-wrap: nowrap; align-items: center; }
.card-edit input { padding: 8px 10px; }

/* Cards list view: nudge Save (end of the Edit column) and Delete (last column)
   closer together by trimming the padding between just those two cells. */
.cards-edit-table td:nth-last-child(2) { padding-right: 4px; }
.cards-edit-table td:last-child { padding-left: 4px; }
.card-edit .fld-rename { width: 130px; }
.card-edit .fld-imgurl { width: 210px; }
.card-edit .fld-rarity { width: 118px; }
.card-edit button { flex: none; }
.mini-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.mini-card .mc-img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: contain;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; display: block;
}
.mini-card .mc-noimg {
  width: 100%; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 2rem;
}
.mini-card .mc-name { font-weight: 600; font-size: .92rem; margin-top: 8px; }
.mini-card .mc-meta { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; }
.mini-card .mc-price { color: var(--primary-2); font-weight: 700; font-size: .95rem; }
.mini-card form { margin: 6px 0 0; }
.mini-card input[type="number"] { width: 100%; }
.rarity-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; border: 1px solid rgba(255,255,255,.15); }

/* Not-yet-collected cards in the Set view: dimmed + desaturated. */
.mini-card.locked { opacity: .6; }
.mini-card.locked .mc-img, .mini-card.locked .mc-noimg { filter: grayscale(1) brightness(.55); }

/* Set view (dashboard "Set progress"): one block per set + a card thumbnail grid. */
.set-view { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.set-view:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.set-view-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.set-view-head strong { font-size: 1.02rem; }
.set-view-desc { margin: 4px 0 8px; font-style: italic; }
.set-view-grid { margin-top: 14px; }

/* Confirmation modal (destructive actions) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px); padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; max-width: 440px; width: 100%; box-shadow: var(--shadow);
}
.modal h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.15rem; margin: 0 0 10px; }
.modal .danger-note { color: var(--danger); font-size: .85rem; font-weight: 500; margin: 10px 0 16px; }
.modal .check-row { margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
form.stack { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }

/* --- badges & progress --- */
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: .72rem; font-weight: 600; letter-spacing: .5px; vertical-align: middle; }
.badge.premium { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.badge.free { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }

.progress { background: var(--bg-2); border: 1px solid var(--border); border-radius: 20px; height: 14px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 20px; }

/* --- flash --- */
.flash { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid var(--border); }
.flash.success { background: rgba(76,175,80,.1); border-color: rgba(76,175,80,.5); }
.flash.error { background: rgba(240,85,92,.1); border-color: rgba(240,85,92,.5); }

/* --- hero (landing / donate) --- */
.hero { text-align: center; padding: 70px 20px 30px; }
.hero img { width: 220px; height: 220px; margin: 0 auto -18px; display: block; filter: drop-shadow(0 8px 26px rgba(139,123,255,.45)); }
.hero h1 { font-size: 3rem; font-weight: 600; }
.hero .accent { color: var(--primary-2); }
.hero p { color: var(--muted); max-width: 580px; margin: 12px auto 26px; }

/* --- guild layout: sidebar tabs --- */
.layout { display: flex; gap: 26px; align-items: flex-start; }
.sidebar { width: 224px; flex-shrink: 0; position: sticky; top: 90px; }
.sidebar .side-link {
  display: block; padding: 11px 15px; border-radius: var(--radius-sm); color: var(--muted);
  font-weight: 500; font-size: .92rem; cursor: pointer; margin-bottom: 3px; border: 1px solid transparent; transition: all var(--transition);
}
.sidebar .side-link:hover { background: var(--panel-2); color: var(--text); }
.sidebar .side-link.active { background: linear-gradient(135deg, rgba(142,99,243,.22), rgba(139,123,255,.08)); color: var(--text); border-color: rgba(142,99,243,.5); }
.sidebar .side-sep { height: 1px; background: var(--border); margin: 12px 6px; }
.content { flex: 1; min-width: 0; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .sidebar .side-link { margin: 0; }
  .sidebar .side-sep { display: none; }
}

hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
code { background: var(--bg-2); padding: 2px 7px; border-radius: 6px; color: var(--primary-2); font-size: .88em; }

/* --- plan cards (premium): neutral until selected --- */
.plan {
  background: linear-gradient(165deg, var(--panel-2), var(--panel-solid));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-align: center;
  cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.plan:hover { transform: translateY(-2px); }
.plan.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(142,99,243,.35), var(--shadow); }
.plan .name { font-size: 1.2rem; font-weight: 600; }
.plan .price { font-size: 2rem; font-weight: 700; color: var(--primary-2); margin: 8px 0; }
.plan .price small { font-size: .85rem; color: var(--muted); font-weight: 400; }
.plan .pp-slot { margin-top: 14px; }

/* --- donation page (Nephbox-style) --- */
.hero-icon {
  width: 96px; height: 96px; margin: 0 auto 22px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(142,99,243,.22), rgba(122,83,224,.18));
  display: flex; align-items: center; justify-content: center; color: var(--primary-2);
}
.hero-icon svg { width: 46px; height: 46px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; margin: 30px 0 16px; }
.section-title svg { width: 20px; height: 20px; color: var(--primary-2); }

.support-card { background: linear-gradient(180deg, var(--panel-2), var(--panel-solid)); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.support-card .head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.support-card .head svg { width: 26px; height: 26px; color: var(--primary-2); }
.support-card h4 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.amount-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.amount-btn { flex: 1; min-width: 68px; text-align: center; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-weight: 600; transition: all var(--transition); }
.amount-btn:hover { border-color: var(--primary); color: #fff; background: rgba(142,99,243,.14); }
.help-list { list-style: none; padding: 0; margin: 0; }
.help-list li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; color: var(--muted); border-bottom: 1px solid var(--border); }
.help-list li:last-child { border-bottom: none; }
.help-list svg { width: 18px; height: 18px; color: var(--primary-2); flex-shrink: 0; margin-top: 3px; }

.expense-item { margin-bottom: 16px; }
.expense-track { background: var(--bg-2); border-radius: 20px; height: 12px; overflow: hidden; border: 1px solid var(--border); }
.expense-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 20px; }
.expense-row { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; }
.expense-row .val { color: var(--primary-2); font-weight: 600; }

.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.faq-q { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; cursor: pointer; font-weight: 500; }
.faq-q svg { width: 16px; height: 16px; transition: transform var(--transition); }
.faq-item.open .faq-q svg { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height var(--transition), padding var(--transition); color: var(--muted); padding: 0 18px; }
.faq-item.open .faq-a { max-height: 320px; padding: 0 18px 16px; }

.thankyou { text-align: center; padding: 40px 20px; }
.thankyou .hero-icon { color: var(--success); background: linear-gradient(135deg, rgba(76,175,80,.2), rgba(76,175,80,.1)); }

/* Language switcher in the navbar (i18n) */
.lang-switch {
  background: var(--panel-2, #1e1e30); color: var(--text, #f0f0f5);
  border: 1px solid var(--border, #2a2a40); border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer;
  max-width: 100%;
}
.lang-switch:hover { border-color: var(--primary, #8b7bff); }

/* ===================================================================
   Mobile / small-screen refinements (dashboard + chrome)
   =================================================================== */

/* Never let the page scroll sideways: only designated containers do. */
html, body { max-width: 100%; overflow-x: hidden; }

/* The top nav is a single flex row by default; on narrow screens let it wrap
   instead of overflowing (it now also holds the language switcher). */
@media (max-width: 720px) {
  .nav { flex-wrap: wrap; gap: 10px 14px; padding: 12px 16px; }
  .nav .brand { font-size: 1.05rem; }
  .nav .brand img { width: 46px; height: 46px; }
  .nav .links { gap: 10px 14px; flex-wrap: wrap; row-gap: 8px; font-size: .85rem; }
  .lang-switch { padding: 5px 8px; font-size: .8rem; }

  .container { padding: 22px 14px; }
  .panel { padding: 18px 15px; }
  h1 { font-size: 1.5rem; }

  /* Any remaining tables scroll rather than stretching the page (wide editor
     tables already use .table-wrap / .view-list at every width). */
  .content table { max-width: 100%; }
  form.stack { max-width: 100%; }

  /* Set-management rows stack the label + button vertically on phones. */
  .set-item { flex-direction: column; align-items: stretch; gap: 12px; }
  .set-item button { width: 100%; }
}

/* Very small phones: give the landing hero and modal a little more room. */
@media (max-width: 420px) {
  .hero { padding: 44px 16px 20px; }
  .hero h1 { font-size: 2.1rem; }
  .hero img { width: 160px; height: 160px; }
  .modal { padding: 20px 16px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
}
