@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700;900&family=Figtree:ital,wght@0,300;0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --pink:    #ea516f;
    --pink-lt: #f07d93;
    --pink-dk: #c03050;
    --bg:      #111113;
    --bg2:     #18181b;
    --bg3:     #1e1e22;
    --bg4:     #26262c;
    --border:  rgba(234,81,111,0.15);
    --line:    rgba(255,255,255,0.06);
    --text:    #f2eef0;
    --muted:   #887f84;
    --green:   #57f287;
    --red:     #ed4245;
    --sidebar: 200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Figtree', sans-serif; min-height: 100%; }
a { color: inherit; text-decoration: none; }

/* ── App shell ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar — slim ── */
.sidebar {
    width: var(--sidebar); flex-shrink: 0;
    background: var(--bg2); border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 50; overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 9px;
    padding: 18px 16px 14px; border-bottom: 1px solid var(--line);
    text-decoration: none;
}
.sidebar-brand img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1.5px solid rgba(234,81,111,0.4); flex-shrink: 0; }
.sidebar-brand-text {
    font-family: 'Golos Text', sans-serif; font-weight: 900; font-size: 0.95rem; letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--pink), var(--pink-lt));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sidebar-guild {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg3);
}
.sidebar-guild-icon {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    background: var(--bg4); display: flex; align-items: center; justify-content: center;
    font-family: 'Golos Text', sans-serif; font-weight: 900; font-size: 0.78rem; color: var(--pink-lt);
}
.sidebar-guild-name { font-weight: 700; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-guild-label { font-size: 0.65rem; color: var(--muted); }
.sidebar-nav { padding: 10px 8px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 10px; border-radius: 8px; margin-bottom: 1px;
    font-size: 0.82rem; font-weight: 500; color: var(--muted);
    cursor: pointer; transition: color 0.15s, background 0.15s;
    border: none; background: none; text-align: left;
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--pink-lt); background: rgba(234,81,111,0.1); font-weight: 600; }
.nav-section-label {
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
    font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted); padding: 10px 10px 4px;
}
.sidebar-bottom {
    padding: 12px 8px; border-top: 1px solid var(--line);
}
.user-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px; background: var(--bg3);
}
.user-chip img { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.user-chip-name { font-size: 0.78rem; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 4px; display: flex; flex-shrink: 0; }
.btn-logout:hover { color: var(--red); }
.btn-logout svg { width: 14px; height: 14px; }

/* ── Main ── */
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px;
    background: rgba(17,17,19,0.85); backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--line);
}
.topbar-title { font-family: 'Golos Text', sans-serif; font-weight: 900; font-size: 1.1rem; letter-spacing: -0.02em; }
.back-link { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); transition: color 0.15s; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 14px; height: 14px; }
.content { padding: 28px; }

/* ── Login ── */
.login-screen {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center; gap: 20px; padding: 24px;
}
.login-glow {
    position: fixed; top: -200px; left: 50%; transform: translateX(-50%);
    width: 600px; height: 600px; border-radius: 50%;
    background: radial-gradient(circle, rgba(234,81,111,0.12), transparent 65%); pointer-events: none;
}
.login-screen .logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(234,81,111,0.4); box-shadow: 0 0 32px rgba(234,81,111,0.2); }
.login-screen h1 { font-family: 'Golos Text', sans-serif; font-weight: 900; font-size: 2.2rem; letter-spacing: -0.03em; }
.login-screen h1 .accent { background: linear-gradient(135deg, var(--pink), var(--pink-lt)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-screen p { color: var(--muted); font-size: 0.95rem; max-width: 380px; line-height: 1.7; }
.login-error { color: var(--red); font-size: 0.85rem; background: rgba(237,66,69,0.08); border: 1px solid rgba(237,66,69,0.25); border-radius: 10px; padding: 10px 16px; }

/* ── Server picker ── */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.server-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
    padding: 24px 16px; cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.server-card:hover { border-color: var(--pink); transform: translateY(-2px); }
.server-card.disabled { opacity: 0.4; pointer-events: none; }
.server-icon {
    width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: var(--bg3); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Golos Text', sans-serif; font-weight: 900; font-size: 1.4rem; color: var(--pink-lt);
}
.server-name { font-weight: 700; font-size: 0.9rem; text-align: center; }
.server-tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 3px 8px; background: var(--bg3); border-radius: 100px; }
.server-tag.manage { color: var(--pink-lt); background: rgba(234,81,111,0.1); }
.server-tag.missing { color: var(--red); background: rgba(237,66,69,0.08); }

/* ── Page header ── */
.page-header { margin-bottom: 28px; }
.page-title { font-family: 'Golos Text', sans-serif; font-weight: 900; font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 0.88rem; line-height: 1.6; }

/* ── Stats banner ── */
.stats-banner {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.stat-pill {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 100px;
    background: var(--bg2); border: 1px solid var(--line);
    font-size: 0.82rem; font-weight: 600; color: var(--muted);
}
.stat-pill svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--pink); }
.stat-pill span { color: var(--text); }
.stat-pill-green { color: var(--green) !important; }

/* ── Modules grid ── */
.modules-grid {
    display: flex; flex-direction: column; gap: 1px;
    background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.module-card {
    display: flex; align-items: center; gap: 16px; padding: 16px 20px;
    background: var(--bg2); transition: background 0.15s;
}
.module-card:hover { background: var(--bg3); }
.module-icon {
    width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
    background: rgba(234,81,111,0.08); color: var(--pink);
    display: flex; align-items: center; justify-content: center;
}
.module-icon svg { width: 18px; height: 18px; }
.module-info { flex: 1; min-width: 0; }
.module-name { font-weight: 700; font-size: 0.9rem; }
.module-desc { font-size: 0.75rem; color: var(--muted); margin-top: 1px; }
.module-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.btn-settings {
    padding: 5px 14px; border-radius: 7px; font-size: 0.78rem; font-weight: 600;
    color: var(--muted); background: var(--bg3); border: 1px solid var(--line); cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.btn-settings:hover { color: var(--pink-lt); border-color: var(--pink); }

/* ── Views ── */
.view { display: none; animation: fadeIn 0.2s ease both; }
.view.active { display: block; }

/* ── Toggle switch ── */
.switch { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; background: var(--bg4); border: 1px solid var(--line); border-radius: 100px; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.switch-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: transform 0.2s, background 0.2s; }
.switch input:checked + .switch-slider { background: rgba(234,81,111,0.2); border-color: var(--pink); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); background: var(--pink); }


/* ── Cards / form sections within modules ── */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.card:last-of-type { margin-bottom: 0; }
.card-title { font-family: 'Golos Text', sans-serif; font-weight: 800; font-size: 0.95rem; margin-bottom: 4px; }
.card-desc { color: var(--muted); font-size: 0.82rem; margin-bottom: 16px; line-height: 1.6; }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field-row:last-child { border-bottom: none; padding-bottom: 0; }
.field-label { font-size: 0.87rem; font-weight: 600; }
.field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 2px; line-height: 1.5; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.field-group label { display: block; font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

input[type="number"], input[type="text"], select, textarea {
    width: 100%; padding: 8px 11px; border-radius: 8px;
    background: var(--bg4); border: 1px solid var(--line); color: var(--text);
    font-size: 0.87rem; font-family: inherit; transition: border-color 0.15s;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); }
select { cursor: pointer; }

code { font-family: 'JetBrains Mono', monospace; font-size: 0.83em; background: var(--bg4); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--pink-lt); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 9px; font-family: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; border: none; transition: opacity 0.15s, transform 0.15s; }
.btn-save { background: linear-gradient(135deg, var(--pink-dk), var(--pink)); color: #fff; }
.btn-save:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--pink); color: var(--pink-lt); }
.btn-danger { background: rgba(237,66,69,0.1); color: #ff8a8d; border: 1px solid rgba(237,66,69,0.25); }
.btn-danger:hover { background: rgba(237,66,69,0.18); }
.btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 7px; }
.btn-icon svg { width: 14px; height: 14px; }
.btn-primary {
    display: inline-flex; align-items: center; gap: 9px; padding: 13px 28px; border-radius: 100px;
    font-size: 0.92rem; font-weight: 700; color: #fff; font-family: inherit;
    background: linear-gradient(135deg, var(--pink-dk), var(--pink)); border: 1px solid rgba(234,81,111,0.4); cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-2px); }
.btn-primary svg { width: 18px; height: 18px; }
.actions-bar { display: flex; align-items: center; gap: 12px; margin-top: 18px; }

/* ── Table (reaction roles / level rewards) ── */
.rr-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.rr-table th { text-align: left; padding: 9px 11px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.rr-table td { padding: 9px 11px; border-bottom: 1px solid var(--line); }
.rr-table tr:last-child td { border-bottom: none; }
.rr-empty { color: var(--muted); font-size: 0.83rem; padding: 16px 0; text-align: center; }
.add-binding-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) auto; gap: 10px; align-items: end; margin-top: 16px; }

/* ── Toast ── */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--bg3); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 22px; font-size: 0.85rem; font-weight: 600;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.6);
    opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(87,242,135,0.35); color: var(--green); }
.toast.error { border-color: rgba(237,66,69,0.35); color: #ff8a8d; }

/* ── Loading / empty ── */
.loading, .empty-state { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 56px 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
    :root { --sidebar: 0px; }
    .sidebar { transform: translateX(-200px); transition: transform 0.25s ease; width: 200px; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .modules-grid { border-radius: 10px; }
}
