/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg:           #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary:  #1c2128;
    --sidebar-bg:   #161b22;
    --border:       #30363d;
    --text:         #e6edf3;
    --text-muted:   #7d8590;
    --accent:       #5865F2;
    --accent-hover: #4752c4;
    --green:        #3fb950;
    --red:          #f85149;
    --yellow:       #d29922;
    --sidebar-w:    240px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: 0.95rem; }

/* ── Login Page ─────────────────────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(ellipse at center, #1a1f2e 0%, #0d1117 70%); }
.login-container { width: 100%; max-width: 420px; padding: 24px; }
.login-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; text-align: center; }
.login-logo { margin-bottom: 32px; }
.logo-icon { font-size: 3rem; margin-bottom: 12px; }
.login-card h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; }
.login-card p { color: var(--text-muted); }
.login-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 12px; }
.btn-discord { display: flex; align-items: center; justify-content: center; background: #5865F2; color: #fff; border: none; border-radius: 8px; padding: 14px 24px; font-size: 1rem; font-weight: 600; cursor: pointer; width: 100%; margin-top: 24px; transition: background .2s; }
.btn-discord:hover { background: #4752c4; }

/* ── Guild Select ─────────────────────────────────────────────────────────── */
.guild-select-page { min-height: 100vh; background: var(--bg); padding: 40px 24px; }
.guild-select-container { max-width: 900px; margin: 0 auto; }
.guild-select-header { text-align: center; margin-bottom: 40px; }
.guild-select-header h1 { font-size: 2rem; margin-bottom: 8px; }
.guild-select-header p { color: var(--text-muted); }
.user-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-secondary); border: 1px solid var(--border); padding: 6px 16px; border-radius: 24px; margin-top: 16px; font-size: 0.9rem; }
.user-badge img { width: 24px; height: 24px; border-radius: 50%; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.guild-card { display: flex; align-items: center; gap: 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; transition: border-color .2s, transform .1s; }
.guild-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.guild-card-icon { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.guild-icon-placeholder { background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; }
.guild-card-name { flex: 1; font-weight: 600; }
.guild-card-arrow { color: var(--text-muted); }
.no-guilds { text-align: center; padding: 60px; color: var(--text-muted); grid-column: 1/-1; }

/* ── Dashboard Layout ──────────────────────────────────────────────────────── */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; }
.sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand-icon { font-size: 1.4rem; }
.sidebar-guild { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.guild-icon { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.guild-name { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { list-style: none; padding: 8px 0; flex: 1; }
.sidebar-nav li { margin: 2px 8px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--bg-tertiary); color: var(--text); }
.nav-link.active { background: rgba(88,101,242,.15); color: var(--accent); }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; }
.user-name { font-size: 0.9rem; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { display: block; text-align: center; padding: 8px; border-radius: 8px; background: rgba(248,81,73,.1); color: var(--red); font-size: 0.85rem; font-weight: 600; transition: background .2s; }
.btn-logout:hover { background: rgba(248,81,73,.2); }

.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 32px; max-width: calc(100vw - var(--sidebar-w)); }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 1.6rem; font-weight: 700; }
.text-muted { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card-disabled { opacity: .5; pointer-events: none; }

/* ── Stats Grid ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; }
.stat-icon { font-size: 1.8rem; margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ── Module Grid ─────────────────────────────────────────────────────────── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.module-card { display: flex; align-items: center; gap: 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: border-color .2s, transform .1s; cursor: pointer; }
.module-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.module-card.active { border-color: rgba(63,185,80,.4); }
.module-icon { font-size: 2rem; }
.module-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
input[type="text"], input[type="url"], select, textarea {
    width: 100%; padding: 10px 14px; background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--bg-tertiary); }
.hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }

/* ── Toggle ──────────────────────────────────────────────────────────────── */
.toggle-label { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 26px; cursor: pointer; transition: background .2s; }
.slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: var(--text-muted); border-radius: 50%; transition: transform .2s, background .2s; }
.toggle input:checked + .slider { background: rgba(63,185,80,.2); border-color: var(--green); }
.toggle input:checked + .slider::before { transform: translateX(22px); background: var(--green); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; cursor: pointer; border: none; transition: opacity .2s, transform .1s; }
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(248,81,73,.15); color: var(--red); border: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 4px 8px; border-radius: 6px; transition: background .15s; }
.btn-icon:hover { background: var(--bg-tertiary); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.badge-green { background: rgba(63,185,80,.15); color: var(--green); }
.badge-gray  { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-soon  { background: rgba(210,153,34,.15); color: var(--yellow); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; }
.alert-error { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.3); color: var(--red); }

/* ── Service list ────────────────────────────────────────────────────────── */
.service-list { display: flex; flex-direction: column; gap: 8px; }
.service-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-tertiary); border-radius: 8px; }
.service-name { font-weight: 600; min-width: 100px; }
.service-url { color: var(--text-muted); font-size: 0.85rem; flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* ── Info box ────────────────────────────────────────────────────────────── */
.info-box { background: rgba(88,101,242,.1); border: 1px solid rgba(88,101,242,.3); border-radius: 8px; padding: 12px 16px; font-size: 0.9rem; }

/* ── Coming soon ────────────────────────────────────────────────────────── */
.coming-soon-banner { background: rgba(210,153,34,.1); border: 1px solid rgba(210,153,34,.3); border-radius: 8px; padding: 16px; text-align: center; font-weight: 600; color: var(--yellow); }

/* ── Platform icons ──────────────────────────────────────────────────────── */
.platform-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.platform-icon { font-size: 1.5rem; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 14px 20px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; z-index: 1000; animation: slideIn .3s ease; }
.toast.success { background: rgba(63,185,80,.9); color: #fff; }
.toast.error { background: rgba(248,81,73,.9); color: #fff; }
.toast.hidden { display: none; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
