:root {
    --text: #f4f6fb;
    --muted: #a9b0c4;
    --glass: rgba(255, 255, 255, 0.09);
    --glass-strong: rgba(255, 255, 255, 0.14);
    --border: rgba(255, 255, 255, 0.18);
    --accent: #6ea8fe;
    --accent2: #8a7bff;
    --green: #5ad19b;
    --red: #ff6b6b;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    --radius: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
}

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

body {
    min-height: 100vh;
    color: var(--text);
    background: #0b0e17;
    overflow-x: hidden;
}

/* Sanfter, animierter Verlaufs-Hintergrund (Apple-Style) */
.bg {
    position: fixed;
    inset: -20%;
    z-index: -1;
    background:
        radial-gradient(45% 45% at 20% 20%, rgba(110, 168, 254, 0.35), transparent 60%),
        radial-gradient(40% 40% at 80% 15%, rgba(138, 123, 255, 0.30), transparent 60%),
        radial-gradient(50% 50% at 75% 85%, rgba(90, 209, 155, 0.22), transparent 60%),
        radial-gradient(45% 45% at 15% 90%, rgba(255, 107, 107, 0.18), transparent 60%),
        #0b0e17;
    filter: saturate(1.1);
    animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-3%, -2%) scale(1.06); }
}

/* Glas-Grundelement */
.glass {
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Login / Pending Seiten */
body.center { display: flex; align-items: center; justify-content: center; }
.card {
    background: var(--glass);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 44px;
    text-align: center;
    max-width: 380px;
}
.card h1 { margin-bottom: 10px; font-weight: 600; }
.card p { color: var(--muted); margin-bottom: 8px; }

/* Topbar */
.topbar {
    position: sticky;
    top: 16px;
    margin: 16px 20px 0;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
}
#whoami { font-weight: 500; }

.tabs { display: flex; gap: 6px; align-items: center; }
.tab {
    background: transparent; border: none; color: var(--muted);
    padding: 9px 16px; border-radius: 12px; cursor: pointer;
    font-size: 15px; font-family: inherit; text-decoration: none;
    transition: all .2s;
}
.tab:hover { color: var(--text); background: var(--glass-strong); }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.tab.logout { color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Stat-Karten */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.stat { padding: 22px 24px; }
.stat-label { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.stat-value { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.top-list { list-style: none; }
.top-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.top-list li:last-child { border: none; }
.top-list .rank { color: var(--accent); font-weight: 700; margin-right: 10px; }

/* Toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; padding: 14px 18px; margin-bottom: 18px; }
.toolbar h2 { font-size: 18px; font-weight: 600; }
.search {
    flex: 1; background: rgba(0,0,0,.2); border: 1px solid var(--border);
    color: var(--text); padding: 11px 16px; border-radius: 14px; font-size: 15px; font-family: inherit;
}
.search:focus { outline: none; border-color: var(--accent); }

/* Item-Grid */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.item-card {
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: transform .18s, background .18s, border-color .18s;
}
.item-card:hover { transform: translateY(-4px); background: var(--glass-strong); border-color: var(--accent); }
.item-card .item-name { font-weight: 600; font-size: 14px; margin: 8px 0 4px; word-break: break-word; }
.item-card .item-price { color: var(--green); font-size: 13px; }
.item-card .item-price .sell { color: var(--red); }
.item-card .tags { margin-top: 6px; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }

.item-img {
    width: 100%; height: 72px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 6px;
}
.item-img img {
    width: 64px; height: 64px;
    object-fit: contain; image-rendering: pixelated; display: block;
}
.item-img.big { width: 72px; height: 72px; }
.item-img.big img { width: 72px; height: 72px; }

.tag { font-size: 10px; padding: 2px 8px; border-radius: 20px; }
.tag.buy { background: rgba(90,209,155,.2); color: var(--green); }
.tag.sell { background: rgba(255,107,107,.2); color: var(--red); }

/* Nutzer-Grid */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.user-card {
    background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border); border-radius: 16px; padding: 16px;
}
.user-card .name { font-weight: 600; margin-bottom: 6px; }
.user-card .actions { display: flex; gap: 8px; margin-top: 12px; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.badge.APPROVED { background: rgba(90,209,155,.2); color: var(--green); }
.badge.PENDING { background: rgba(250,190,80,.2); color: #ffce6b; }
.badge.REJECTED { background: rgba(255,107,107,.2); color: var(--red); }

/* Buttons */
.btn {
    background: var(--glass-strong); border: 1px solid var(--border); color: var(--text);
    padding: 10px 18px; border-radius: 14px; cursor: pointer; font-size: 14px;
    font-family: inherit; text-decoration: none; transition: all .18s;
}
.btn:hover { background: rgba(255,255,255,.2); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(255,107,107,.9); border-color: transparent; color: #fff; }
.btn.green { background: rgba(90,209,155,.9); border-color: transparent; color: #06231a; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.discord { display: inline-flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; background: linear-gradient(135deg, #5865F2, #8a7bff); border: none; color: #fff; padding: 12px 22px; font-weight: 600; }
.btn.discord svg { flex-shrink: 0; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; z-index: 50;
    display: none; align-items: center; justify-content: center;
    background: rgba(4, 6, 12, 0.55); backdrop-filter: blur(6px);
}
.modal-overlay.show { display: flex; animation: fade .2s ease; }
.modal { position: relative; width: min(460px, 92vw); padding: 26px 28px; }
.modal-close {
    position: absolute; top: 16px; right: 18px; background: none; border: none;
    color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.modal-head h3 { font-weight: 600; font-size: 20px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select {
    background: rgba(0,0,0,.25); border: 1px solid var(--border); color: var(--text);
    padding: 10px 12px; border-radius: 12px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

/* Toggle-Switches (Kaufbar/Verkaufbar) */
.switches { display: flex; gap: 24px; margin-top: 4px; }
.switch { flex-direction: row; align-items: center; gap: 10px; color: var(--text); cursor: pointer; font-size: 14px; }
.switch input { display: none; }
.switch .slider { width: 44px; height: 26px; border-radius: 20px; background: rgba(255,255,255,.18); position: relative; transition: .2s; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .slider { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.switch input:checked + .slider::after { transform: translateX(18px); }

.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

/* Toast */
.toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--glass-strong); backdrop-filter: blur(20px); border: 1px solid var(--border);
    padding: 13px 22px; border-radius: 14px; opacity: 0; transition: all .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); }
.toast.ok { border-color: var(--green); }

/* Profil-Dropdown (oben links) */
.profile { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; padding: 4px 8px; border-radius: 14px; transition: background .15s; }
.profile:hover { background: var(--glass-strong); }
.profile .chev { color: var(--muted); transition: transform .2s; }
.profile.open .chev { transform: rotate(180deg); }
.dropdown {
    position: absolute; top: 110%; left: 0; min-width: 160px;
    background: var(--glass-strong); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
    padding: 6px; display: none; z-index: 40;
}
.profile.open .dropdown { display: block; }
.dropdown a { display: block; padding: 10px 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.dropdown a:hover { background: rgba(255,255,255,.12); }

/* Wizard */
.wizard-modal { width: min(560px, 94vw); }
.wizard-head { margin-bottom: 18px; }
.wizard-head h3 { font-weight: 600; font-size: 20px; margin-bottom: 12px; }
.steps { display: flex; gap: 8px; }
.steps .dot { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); transition: background .2s; }
.steps .dot.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.wz-step { display: flex; flex-direction: column; gap: 14px; min-height: 220px; }

.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.chip {
    background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px 12px; text-align: center; cursor: pointer; transition: all .15s; font-weight: 500;
}
.chip:hover { background: var(--glass-strong); }
.chip.active { border-color: var(--accent); background: linear-gradient(135deg, rgba(110,168,254,.25), rgba(138,123,255,.25)); }

.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; max-height: 320px; overflow-y: auto; padding: 4px; }
.mat-tile {
    background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 12px;
    padding: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .12s;
    aspect-ratio: 1;
}
.mat-tile:hover { background: var(--glass-strong); }
.mat-tile.active { border-color: var(--accent); background: linear-gradient(135deg, rgba(110,168,254,.3), rgba(138,123,255,.3)); }
.mat-tile img { width: 38px; height: 38px; image-rendering: pixelated; }
.mat-selected { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

/* Segmented control (Kaufen/Verkaufen/Beides) */
.segmented { display: flex; background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; background: none; border: none; color: var(--muted); padding: 10px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 14px; transition: all .15s; }
.segmented button.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }

@media (max-width: 640px) {
    .stats { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; gap: 12px; }
}
