/* CMS Hub — تم مشکی مات */
:root {
    --hub-bg: #121212;
    --hub-bg-elevated: #1a1a1a;
    --hub-bg-card: #1e1e1e;
    --hub-bg-input: #252525;
    --hub-sidebar: #0d0d0d;
    --hub-border: #2d2d2d;
    --hub-border-soft: #333333;
    --hub-text: #f0f0f0;
    --hub-text-muted: #9ca3af;
    --hub-text-dim: #6b7280;
    --hub-accent: #f5c518;
    --hub-accent-hover: #e6b800;
    --hub-accent-soft: rgba(245, 197, 24, 0.12);
    --hub-white: #ffffff;
    --hub-success: #4ade80;
    --hub-success-bg: rgba(74, 222, 128, 0.12);
    --hub-error: #f87171;
    --hub-error-bg: rgba(248, 113, 113, 0.12);
    --hub-warning: #fbbf24;
    --hub-warning-bg: rgba(251, 191, 36, 0.12);
    --hub-info: #f5c518;
    --hub-info-bg: rgba(245, 197, 24, 0.1);
    --hub-radius: 10px;
}

*,
::before,
::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--hub-bg);
    color: var(--hub-text);
    direction: rtl;
}

a {
    color: var(--hub-accent);
}

a:hover {
    color: var(--hub-accent-hover);
}

h2, h3, h4 {
    color: var(--hub-white);
}

.hub-layout {
    display: flex;
    min-height: 100vh;
    background: var(--hub-bg);
}

.hub-sidebar {
    position: relative;
    width: 260px;
    min-height: 100vh;
    background:
        linear-gradient(168deg, #161616 0%, #0c0c0c 42%, #080808 100%);
    color: var(--hub-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        -12px 0 40px rgba(0, 0, 0, 0.55),
        inset 1px 0 0 rgba(255, 255, 255, 0.04);
    z-index: 2;
}

/* نورهای ambient داخل سایدبار */
.hub-sidebar-glow {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(40px);
    z-index: 0;
}

.hub-sidebar-glow-top {
    top: -30px;
    right: -20px;
    width: 160px;
    height: 160px;
    background: rgba(245, 197, 24, 0.18);
}

.hub-sidebar-glow-bottom {
    bottom: 40px;
    left: -40px;
    width: 120px;
    height: 120px;
    background: rgba(245, 197, 24, 0.07);
}

/* خط نور بین سایدبار و محتوا (سمت چپ پنل در RTL) */
.hub-sidebar-edge {
    position: absolute;
    left: 0;
    top: 8%;
    bottom: 8%;
    width: 2px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(245, 197, 24, 0.15) 15%,
        rgba(245, 197, 24, 0.75) 50%,
        rgba(255, 255, 255, 0.2) 55%,
        rgba(245, 197, 24, 0.45) 85%,
        transparent 100%
    );
    box-shadow:
        0 0 14px rgba(245, 197, 24, 0.45),
        0 0 4px rgba(245, 197, 24, 0.8);
    z-index: 3;
}

.hub-sidebar-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 26px 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
}

.hub-sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #111;
    background: linear-gradient(145deg, #ffe066 0%, #f5c518 45%, #b8940f 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12) inset,
        0 4px 18px rgba(245, 197, 24, 0.35),
        0 0 28px rgba(245, 197, 24, 0.2);
}

.hub-sidebar-brand-text h1 {
    font-size: 17px;
    margin: 0 0 3px;
    color: var(--hub-white);
    letter-spacing: 0.02em;
}

.hub-sidebar-brand-text small {
    color: var(--hub-text-dim);
    font-size: 11px;
}

.hub-sidebar-body {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 18px 14px;
}

.hub-sidebar-label {
    display: block;
    padding: 0 10px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hub-text-dim);
}

.hub-sidebar-footer {
    position: relative;
    z-index: 1;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0%, transparent 100%);
}

.hub-sidebar h1 {
    font-size: 18px;
    margin: 0 0 4px;
    color: var(--hub-white);
}

.hub-sidebar small {
    color: var(--hub-text-muted);
}

.hub-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hub-nav a,
.hub-nav-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--hub-text-muted);
    text-decoration: none;
    padding: 11px 12px;
    border-radius: var(--hub-radius);
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid transparent;
}

.hub-nav-icon {
    width: 18px;
    text-align: center;
    font-size: 11px;
    opacity: 0.65;
    color: var(--hub-accent);
}

.hub-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--hub-white);
    border-color: rgba(255, 255, 255, 0.04);
}

.hub-nav a:hover .hub-nav-icon {
    opacity: 1;
}

.hub-nav a.active {
    background: linear-gradient(90deg, rgba(245, 197, 24, 0.16) 0%, rgba(245, 197, 24, 0.06) 100%);
    color: var(--hub-accent);
    font-weight: 600;
    border-color: rgba(245, 197, 24, 0.22);
    box-shadow:
        inset 3px 0 0 var(--hub-accent),
        0 0 20px rgba(245, 197, 24, 0.08);
}

.hub-nav a.active .hub-nav-icon {
    opacity: 1;
}

.hub-nav-logout {
    color: #fca5a5;
}

.hub-nav-logout .hub-nav-icon {
    color: #f87171;
}

.hub-nav-logout:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.2);
}

.hub-main {
    flex: 1;
    padding: 28px 32px;
    min-width: 0;
    background: var(--hub-bg);
    position: relative;
}

/* عمق ملایم پشت محتوا — تفکیک از سایدبار */
.hub-main::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(270deg, rgba(0, 0, 0, 0.35) 0%, transparent 100%);
    pointer-events: none;
}

.hub-card {
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.hub-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.hub-stat {
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: 12px;
    padding: 16px;
}

.hub-stat strong {
    display: block;
    font-size: 24px;
    margin-bottom: 4px;
    color: var(--hub-accent);
}

.hub-stat span {
    color: var(--hub-text-muted);
    font-size: 13px;
}

.hub-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--hub-bg-card);
    border-radius: 12px;
    overflow: hidden;
}

.hub-table th,
.hub-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--hub-border);
    text-align: right;
    color: var(--hub-text);
}

.hub-table th {
    background: var(--hub-bg-elevated);
    color: var(--hub-text-muted);
    font-weight: 600;
    font-size: 13px;
}

.hub-table tr:last-child td {
    border-bottom: none;
}

.hub-table a {
    color: var(--hub-accent);
}

.hub-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.hub-badge-online {
    background: var(--hub-success-bg);
    color: var(--hub-success);
}

.hub-badge-offline {
    background: var(--hub-error-bg);
    color: var(--hub-error);
}

.hub-badge-pending {
    background: var(--hub-warning-bg);
    color: var(--hub-warning);
}

.hub-badge-system {
    background: rgba(0, 120, 212, 0.15);
    color: #4fc3f7;
    margin-right: 8px;
    vertical-align: middle;
}

.hub-panel-agent {
    border-color: rgba(0, 120, 212, 0.35);
}

.hub-btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--hub-radius);
    border: none;
    background: var(--hub-accent);
    color: #111111;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease;
}

.hub-btn:hover {
    background: var(--hub-accent-hover);
    color: #111111;
}

.hub-btn-muted {
    background: var(--hub-bg-input);
    color: var(--hub-text);
    border: 1px solid var(--hub-border);
}

.hub-btn-muted:hover {
    background: #2a2a2a;
    color: var(--hub-white);
}

.hub-form label {
    display: block;
    margin-bottom: 12px;
    color: var(--hub-text-muted);
    font-size: 14px;
}

.hub-form input,
.hub-form textarea,
.hub-form select {
    width: 100%;
    margin-top: 4px;
    padding: 10px 12px;
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    font: inherit;
    background: var(--hub-bg-input);
    color: var(--hub-text);
}

.hub-form input:focus,
.hub-form textarea:focus,
.hub-form select:focus {
    outline: none;
    border-color: var(--hub-accent);
    box-shadow: 0 0 0 2px var(--hub-accent-soft);
}

.hub-form input::placeholder,
.hub-form textarea::placeholder {
    color: var(--hub-text-dim);
}

.hub-alert {
    padding: 10px 12px;
    border-radius: var(--hub-radius);
    margin-bottom: 12px;
    border: 1px solid transparent;
}

.hub-alert-success {
    background: var(--hub-success-bg);
    color: var(--hub-success);
    border-color: rgba(74, 222, 128, 0.25);
}

.hub-alert-error {
    background: var(--hub-error-bg);
    color: var(--hub-error);
    border-color: rgba(248, 113, 113, 0.25);
}

.hub-alert-info {
    background: var(--hub-info-bg);
    color: var(--hub-accent);
    border-color: rgba(245, 197, 24, 0.25);
}

.hub-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse at top, #1a1a1a 0%, #0a0a0a 70%);
}

.hub-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.hub-auth-card h1 {
    color: var(--hub-white);
    margin: 0 0 8px;
}

.hub-muted {
    color: var(--hub-text-muted);
}

.hub-hint {
    color: var(--hub-text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.hub-hint code,
.hub-muted code {
    background: var(--hub-bg-input);
    color: var(--hub-accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.hub-token-box {
    background: var(--hub-bg-input);
    border: 1px dashed var(--hub-border-soft);
    padding: 12px;
    border-radius: var(--hub-radius);
    word-break: break-all;
    font-family: Consolas, monospace;
    direction: ltr;
    text-align: left;
    color: var(--hub-accent);
}

.hub-setup-steps {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.hub-setup-steps span {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--hub-bg-input);
    color: var(--hub-text-dim);
    font-size: 13px;
    border: 1px solid var(--hub-border);
}

.hub-setup-steps span.active {
    background: var(--hub-accent-soft);
    color: var(--hub-accent);
    font-weight: 600;
    border-color: rgba(245, 197, 24, 0.35);
}

.hub-setup-steps span.done {
    background: var(--hub-success-bg);
    color: var(--hub-success);
    border-color: rgba(74, 222, 128, 0.25);
}

.hub-code {
    background: var(--hub-bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    font-size: 13px;
    color: var(--hub-accent);
    border: 1px solid var(--hub-border);
}

/* ——— پشتیبانی: حباب‌های روشن روی تم تیره ——— */
.hub-support-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.hub-support-msg {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    color: #1a1a1a;
}

.hub-support-msg.is-staff {
    background: #e7f5ff;
    border-color: #74c0fc;
}

.hub-support-msg.is-site {
    background: #f8f9fa;
    border-color: #e1dfdd;
}

.hub-support-msg-meta {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 6px;
}

.hub-support-msg-meta strong {
    color: #111827;
}

.hub-support-msg-body {
    line-height: 1.7;
    color: #242424;
}

.hub-support-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--hub-text-muted);
    font-size: 14px;
}

.hub-support-form textarea {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    font: inherit;
    background: var(--hub-bg-input);
    color: var(--hub-text);
    resize: vertical;
}

.hub-support-form textarea:focus {
    outline: none;
    border-color: var(--hub-accent);
    box-shadow: 0 0 0 2px var(--hub-accent-soft);
}

.hub-support-form textarea::placeholder {
    color: var(--hub-text-dim);
}

.hub-panel {
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.hub-panel h3 {
    margin: 0 0 16px;
    font-size: 17px;
}

.hub-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.hub-code-block {
    display: block;
    margin: 12px 0;
    padding: 14px 16px;
    background: var(--hub-bg-input);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--hub-accent);
    overflow-x: auto;
    white-space: pre;
    text-align: left;
}

.hub-mini-list {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: disc;
    font-size: 12px;
    line-height: 1.5;
}

.hub-mini-list li {
    margin-bottom: 4px;
}

.hub-mini-list code {
    background: var(--hub-bg-input);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
}

.hub-link-download {
    color: var(--hub-accent);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.hub-link-download:hover {
    color: var(--hub-accent-hover);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .hub-layout {
        flex-direction: column;
    }

    .hub-sidebar {
        width: 100%;
        min-height: auto;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

    .hub-sidebar-edge {
        display: none;
    }

    .hub-main::before {
        display: none;
    }
}
