:root {
    --bg-main: #0a0a0f;
    --bg-card: #1a1a2e;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #6366f1;
    --accent-hover: #8b5cf6;
    --text-main: #e2e8f0;
    --text-sec: #94a3b8;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-btn {
    text-decoration: none;
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-icon {
    flex-shrink: 0;
    color: var(--text-sec);
}

.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.icon-box {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
}

.site-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.help-feature-icon,
.help-tab-icon svg {
    color: var(--accent);
}

.loader {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-only {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-sec);
    cursor: pointer;
    font-size: 0.85em;
    font-family: inherit;
    padding: 0;
}

.btn-icon-only:hover {
    color: var(--text-main);
}

.quiz-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-sec);
    font-size: 0.9em;
}

.help-empty-icon {
    color: var(--text-sec);
    margin-bottom: 16px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.danger {
    color: #ef4444;
}

.nav-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

#content {
    flex: 1;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.input, .btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    font-family: inherit;
}

.input {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
}

.btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s, transform 0.15s;
    border: none;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

.msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.msg.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
}

.msg.bot {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.msg a {
    color: #60a5fa;
}

.typing-indicator {
    color: var(--text-sec);
    font-style: italic;
    font-size: 0.9em;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.quiz-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-sec);
    font-weight: 500;
}

/* Help page */
.help-header {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.help-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.help-tabs .help-tab-btn {
    flex: 1;
    justify-content: center;
}

.help-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-sec);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s;
}

.help-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.help-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(99, 102, 241, 0.06);
}

.help-tab-icon {
    display: flex;
    align-items: center;
}

.help-body {
    padding: 24px;
    min-height: 300px;
}

.help-empty-state {
    text-align: center;
    padding: 48px 0;
}

.help-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* Sites grid */
.help-sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.help-site-card {
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s;
}

.help-site-card:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.help-site-icon {
    margin-bottom: 8px;
}

.help-site-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-main);
}

.help-site-desc {
    font-size: 12px;
    color: var(--text-sec);
    line-height: 1.4;
}

/* Agent info */
.help-agent-hero {
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.12));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.help-agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.help-agent-tagline {
    margin: 0;
    font-size: 15px;
    color: var(--text-sec);
}

.help-agent-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-feature-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.help-feature-icon {
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
}

.help-feature-item strong {
    display: block;
    margin-bottom: 4px;
}

.help-feature-item p {
    margin: 0;
    color: var(--text-sec);
    font-size: 13px;
    line-height: 1.5;
}

/* How-to steps */
.help-howto-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.help-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.help-step strong {
    display: block;
    margin-bottom: 4px;
}

.help-step p {
    margin: 0;
    color: var(--text-sec);
    font-size: 13px;
    line-height: 1.5;
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85em;
    color: var(--text-sec);
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
    margin: 0;
}

.toggle-switch:checked {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch:checked::after {
    left: calc(100% - 2px);
    transform: translateX(-100%);
}
