/* ══════════════════════════════════════════════════════════
   B0K Platform — Clean Dark Theme
   ══════════════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────────────── */
:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-elevated: #1a1a1a;
    --bg-input: #111111;
    --bg-sidebar: #0e0e0e;
    --bg-hover: rgba(255, 255, 255, 0.03);

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-dim: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.12);
    --accent-glow-strong: rgba(99, 102, 241, 0.25);

    --text: #f0f0f0;
    --text-secondary: #999999;
    --text-muted: #555555;

    --border: #1e1e1e;
    --border-hover: #2e2e2e;

    --danger: #ef4444;
    --danger-dim: #dc2626;
    --danger-glow: rgba(239, 68, 68, 0.12);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-width: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent);
    color: white;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

a { text-decoration: none; color: inherit; }

/* ─── Particles Canvas ───────────────────────────────────── */
#particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ─── Pulse Dot ──────────────────────────────────────────── */
.pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.pulse-dot-sm {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.pulse-dot-warn {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}


/* ══════════════════════════════════════════════════════════
   AUTH PAGE
   ══════════════════════════════════════════════════════════ */

.auth-container {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: cardAppear 0.5s ease-out;
}

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

/* ─── Auth Header ────────────────────────────────────────── */
.auth-header {
    text-align: center;
    padding: 36px 32px 24px;
}

.logo-mark {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.auth-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.auth-header .subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ─── Auth Tabs ──────────────────────────────────────────── */
.auth-tabs {
    display: flex;
    position: relative;
    margin: 0 32px;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 14px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: var(--text);
}

.tab-indicator {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 50%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-tabs:has(.tab[data-tab="register"].active) .tab-indicator {
    transform: translateX(100%);
}

/* ─── Auth Forms ─────────────────────────────────────────── */
.auth-form {
    display: none;
    padding: 28px 32px 32px;
    animation: formFade 0.25s ease-out;
}

.auth-form.active {
    display: block;
}

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

/* ─── Input Groups ───────────────────────────────────────── */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input,
.auth-form input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Submit Button ──────────────────────────────────────── */
.btn-submit {
    width: 100%;
    padding: 12px 20px;
    margin-top: 4px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-submit:hover {
    background: var(--accent-dim);
    box-shadow: 0 4px 16px var(--accent-glow-strong);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit.loading .btn-text { opacity: 0; }
.btn-submit.loading .btn-loader { display: block; }

.btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    position: absolute;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* ══════════════════════════════════════════════════════════
   PANEL PAGE
   ══════════════════════════════════════════════════════════ */

.panel-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
}

.logo-text h2 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.network-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: var(--bg-hover);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}

/* ─── Sidebar Nav ────────────────────────────────────────── */
.sidebar-nav {
    padding: 10px 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 2px;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-light);
    border-color: rgba(99, 102, 241, 0.1);
}

.nav-icon { font-size: 1rem; width: 22px; text-align: center; }

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* ─── Admin Nav ──────────────────────────────────────────── */
.admin-nav {
    padding: 0 8px 8px;
    display: none;
    animation: slideIn 0.4s ease-out;
}

.admin-nav.visible { display: block; }

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

.admin-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 6px;
}

.admin-divider::before,
.admin-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--danger-dim), transparent);
}

.admin-divider span {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--danger);
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.admin-item {
    color: var(--danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.1) !important;
    background: rgba(239, 68, 68, 0.04) !important;
}

.admin-item:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

.admin-item.active {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
}

/* ─── Sidebar Footer ─────────────────────────────────────── */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.user-details { display: flex; flex-direction: column; }

.user-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.btn-logout {
    width: 100%;
    padding: 9px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-logout:hover {
    background: var(--danger-glow);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

/* ─── Views ──────────────────────────────────────────────── */
.view {
    display: none;
    flex-direction: column;
    height: 100%;
    animation: viewFade 0.2s ease-out;
}
.view.active { display: flex; }

@keyframes viewFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ─── View Header ────────────────────────────────────────── */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    min-height: 58px;
}

.view-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-title h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.channel-tag {
    font-size: 0.7rem;
    color: var(--accent-light);
    background: var(--accent-glow);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.view-actions { display: flex; align-items: center; gap: 12px; }

.member-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Admin Header ───────────────────────────────────────── */
.admin-header {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.04), var(--bg-card));
    border-bottom-color: rgba(239, 68, 68, 0.1);
}

.admin-badge {
    font-size: 0.65rem;
    color: var(--danger);
    background: var(--danger-glow);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    letter-spacing: 1px;
    font-weight: 600;
}

/* ─── Messages ───────────────────────────────────────────── */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    animation: msgIn 0.3s ease-out;
}

.message:hover { background: var(--bg-hover); }

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
}

.message-body { flex: 1; min-width: 0; }

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.message-user {
    font-weight: 600;
    font-size: 0.88rem;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.message-text {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.5;
    word-wrap: break-word;
}

/* ─── Message Input ──────────────────────────────────────── */
.message-input-area {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.msg-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.msg-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.msg-input-wrapper input {
    flex: 1;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    outline: none;
}

.msg-input-wrapper input::placeholder { color: var(--text-muted); }

#send-btn {
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}

#send-btn:hover {
    color: var(--accent-light);
    transform: scale(1.1);
}

/* ─── Placeholder Views ──────────────────────────────────── */
.view-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.placeholder-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    height: 100%;
}

.placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.4;
    margin-bottom: 6px;
}

.placeholder-view h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.placeholder-view p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    max-width: 320px;
}

.placeholder-sub {
    font-size: 0.78rem !important;
    color: var(--text-muted) !important;
}

.accent-text {
    color: var(--accent);
    font-weight: 600;
}

/* ─── Admin Panel ────────────────────────────────────────── */
.admin-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color 0.2s ease;
}

.admin-card:hover {
    border-color: var(--border-hover);
}

.admin-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-card-icon { font-size: 1.2rem; }

.admin-card-header h3 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

/* ─── System Status Grid ─────────────────────────────────── */
.system-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.status-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-value {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.status-value.online { color: var(--success); }
.status-value.warning { color: var(--warning); }

/* ─── Ping Tool ──────────────────────────────────────────── */
.tool-description {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.ping-tool {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.ping-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.ping-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.ping-prefix {
    padding: 0 10px 0 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
}

.ping-input-group input {
    flex: 1;
    padding: 10px 12px 10px 0;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    outline: none;
}

.ping-input-group input::placeholder { color: var(--text-muted); }

.btn-ping {
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-ping:hover {
    background: var(--accent-dim);
    box-shadow: 0 4px 12px var(--accent-glow-strong);
    transform: translateY(-1px);
}

.btn-ping:active { transform: translateY(0); }

/* ─── Terminal Output ────────────────────────────────────── */
.terminal-output-wrapper {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #050505;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.sm { width: 8px; height: 8px; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.terminal-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 6px;
}

.terminal-output {
    padding: 14px;
    background: #050505;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
}

.log-output {
    font-size: 0.74rem;
    max-height: 200px;
    color: var(--text-muted);
}

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}


/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    animation: toastIn 0.3s ease-out;
    pointer-events: auto;
    max-width: 360px;
    box-shadow: var(--shadow);
}

.toast.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.toast.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.toast.info {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--accent-light);
}

.toast.removing {
    animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(30px); }
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .auth-card { max-width: 100%; }
    .auth-header { padding: 28px 24px 20px; }
    .auth-tabs { margin: 0 24px; }
    .auth-form { padding: 24px; }

    .sidebar { width: 220px; min-width: 220px; }
    .system-status-grid { grid-template-columns: 1fr; }
    .ping-tool { flex-direction: column; }
}

@media (max-width: 480px) {
    .panel-layout { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; height: auto; max-height: 60px; }
}
