/* ============================================================================
   SuraqHub — База знаний и Руководство конструктора (help.html, help-builder.html)
   Дизайн: Modern Enterprise (Blueprint), 60-30-10, WCAG 2.2 AA
   ============================================================================ */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.08);
    --accent-cyan: #38bdf8;
    --bg-dark: #0f172a;
    --bg-header: #1e293b;
    --bg-body: #f6f8fb;
    --text-main: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --code-bg: #0f172a;
    --radius-lg: 14px;
    --radius-md: 10px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
    --shadow-card-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 12px 28px -8px rgba(37, 99, 235, 0.18);
    --transition-quick: 0.15s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(1200px 400px at 85% -100px, rgba(56, 189, 248, 0.07), transparent 70%),
        radial-gradient(900px 360px at 5% -80px, rgba(37, 99, 235, 0.06), transparent 70%),
        var(--bg-body);
    line-height: 1.6;
}

::selection {
    background: rgba(56, 189, 248, 0.28);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Тонкие скроллбары */
.sidebar::-webkit-scrollbar,
pre.code-block::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
pre.code-block::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 8px;
}

.sidebar::-webkit-scrollbar-track,
pre.code-block::-webkit-scrollbar-track {
    background: transparent;
}

/* ------------------------------------------------------------------ */
/* Шапка                                                               */
/* ------------------------------------------------------------------ */
.help-header {
    background: linear-gradient(90deg, #0b1220 0%, #0f172a 55%, #16233f 100%);
    color: white;
    padding: 0.9rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 4px 20px rgba(2, 6, 23, 0.35);
    border-bottom: 1px solid rgba(56, 189, 248, 0.18);
}

.help-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.55), transparent);
    pointer-events: none;
}

.help-logo {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
}

.help-logo svg {
    margin-right: 0.6rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.45));
}

.text-suraq-cyan {
    color: var(--accent-cyan);
}

/* Поиск */
.search-container {
    position: relative;
    min-width: 260px;
    max-width: 380px;
    width: 100%;
}

.search-input {
    width: 100%;
    height: 42px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    font-size: 0.9rem;
    transition: background-color var(--transition-quick), border-color var(--transition-quick), box-shadow var(--transition-quick);
}

.search-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.search-input:focus {
    outline: none;
    background-color: #1e293b;
    color: #ffffff;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.search-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-quick);
}

.search-input:focus ~ .search-icon {
    color: var(--accent-cyan);
}

/* Переключатель языка справки (RU / ҚАЗ) */
.lang-switch {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9999px;
    flex-shrink: 0;
}

.lang-switch .lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #cbd5e1;
    border-radius: 9999px;
    text-decoration: none !important;
    transition: background-color var(--transition-quick), color var(--transition-quick);
}

.lang-switch .lang-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.lang-switch .lang-link.active {
    color: #0f172a;
    background: var(--accent-cyan);
}

.lang-switch .lang-link:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

/* Кнопки в шапке */
.btn-back-to-manager {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    gap: 8px;
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9999px;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background-color var(--transition-quick), border-color var(--transition-quick), color var(--transition-quick), box-shadow var(--transition-quick);
    flex-shrink: 0;
    cursor: pointer;
}

.btn-back-to-manager:hover {
    color: #ffffff;
    background: rgba(56, 189, 248, 0.16);
    border-color: var(--accent-cyan);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.25);
}

.btn-back-to-manager svg {
    color: var(--accent-cyan);
    transition: transform var(--transition-quick);
    flex-shrink: 0;
}

.btn-back-to-manager:hover svg {
    transform: translateX(-3px);
}

/* ------------------------------------------------------------------ */
/* Сайдбар                                                             */
/* ------------------------------------------------------------------ */
.sidebar {
    position: sticky;
    top: 76px;
    height: calc(100vh - 82px);
    overflow-y: auto;
    padding: 1.5rem 0.75rem 2.5rem 1rem;
    border-right: 1px solid var(--border-color);
    scrollbar-width: thin;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.2));
}

.sidebar-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 1.5rem;
    margin-bottom: 0.45rem;
    padding-left: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-category::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color), transparent);
}

.sidebar-category:first-of-type {
    margin-top: 0;
}

.nav-link-custom {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 8px;
    transition: color var(--transition-quick), background-color var(--transition-quick);
    margin-bottom: 0.15rem;
    text-decoration: none !important;
    font-size: 0.88rem;
}

.nav-link-custom:hover {
    color: var(--primary-dark);
    background-color: var(--primary-soft);
}

.nav-link-custom.active {
    color: var(--primary-dark);
    background-color: var(--primary-soft);
    font-weight: 600;
}

.nav-link-custom.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-cyan));
}

.nav-link-custom i {
    width: 20px;
    margin-right: 0.6rem;
    font-size: 0.9rem;
    text-align: center;
}

/* ------------------------------------------------------------------ */
/* Контент                                                             */
/* ------------------------------------------------------------------ */
.content-area {
    padding: 2.4rem 3rem 3rem 3rem;
    max-width: 1060px;
}

.doc-section {
    margin-bottom: 4.5rem;
    scroll-margin-top: 110px;
}

.doc-section h1 {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--bg-dark);
    margin-bottom: 1.25rem;
    padding-bottom: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}

.doc-section h1::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 72px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-cyan));
}

.doc-section h1::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--border-color);
}

.doc-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #1e293b;
    margin-top: 1.8rem;
    margin-bottom: 0.75rem;
}

.doc-section h3 {
    font-size: 1.08rem;
    font-weight: 600;
    color: #334155;
    margin-top: 1.4rem;
    margin-bottom: 0.5rem;
}

.doc-section .lead {
    color: #475569;
}

/* Карточки */
.help-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    transition: box-shadow var(--transition-quick), border-color var(--transition-quick);
}

.help-card:hover {
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--shadow-card-hover);
}

/* Бейджи разделов */
.badge-layout {
    background-color: var(--primary-soft) !important;
    color: var(--primary-color) !important;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border: 1px solid rgba(37, 99, 235, 0.2);
    flex-shrink: 0;
}

.badge-layout.bg-primary,
.badge-layout.bg-success,
.badge-layout.bg-danger,
.badge-layout.bg-info,
.badge-layout.bg-dark {
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

/* ------------------------------------------------------------------ */
/* Callout-блоки                                                       */
/* ------------------------------------------------------------------ */
.note-box,
.alert-box,
.warning-box {
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1.25rem 0;
}

.note-box {
    background-color: #f0fdf4;
    border-left: 4px solid #10b981;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.08);
}

.note-box h5 {
    color: #047857;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.alert-box {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.08);
}

.alert-box h5 {
    color: #1d4ed8;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.warning-box {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.1);
}

.warning-box h5 {
    color: #b45309;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

/* ------------------------------------------------------------------ */
/* Таблицы                                                             */
/* ------------------------------------------------------------------ */
.doc-table {
    width: 100%;
    margin: 1rem 0 1.5rem 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.doc-table th {
    background-color: #f1f5f9;
    color: #334155;
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.doc-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.doc-table tr:last-child td {
    border-bottom: none;
}

.doc-table tbody tr {
    transition: background-color var(--transition-quick);
}

.doc-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.doc-table tbody tr:hover {
    background-color: var(--primary-soft);
}

/* ------------------------------------------------------------------ */
/* Код                                                                 */
/* ------------------------------------------------------------------ */
pre.code-block {
    background:
        linear-gradient(180deg, rgba(56, 189, 248, 0.06), transparent 40%),
        var(--code-bg);
    color: #f1f5f9;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    overflow-x: auto;
    border: 1px solid #334155;
    margin: 1rem 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    line-height: 1.55;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow-card);
}

code {
    background-color: rgba(37, 99, 235, 0.07);
    color: #0369a1;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.88em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    border: 1px solid rgba(37, 99, 235, 0.12);
}

pre.code-block code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
}

/* ------------------------------------------------------------------ */
/* FAQ                                                                 */
/* ------------------------------------------------------------------ */
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    background: var(--card-bg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-quick), box-shadow var(--transition-quick);
}

.faq-item:hover {
    border-color: rgba(37, 99, 235, 0.3);
}

.faq-item.active {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: var(--shadow-card-hover);
}

.faq-question {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--card-bg);
    transition: background-color var(--transition-quick);
    min-height: 44px;
}

.faq-question:hover {
    background-color: #f8fafc;
    color: var(--primary-dark);
}

.faq-answer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: #fcfcfd;
    font-size: 0.92rem;
    display: none;
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-item.active .faq-toggle-icon {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.faq-toggle-icon {
    transition: transform 0.2s ease, color var(--transition-quick);
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Плитки компонентов (help-builder.html)                              */
/* ------------------------------------------------------------------ */
.comp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.comp-tile {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform var(--transition-quick), box-shadow var(--transition-quick), border-color var(--transition-quick);
}

.comp-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-cyan));
    opacity: 0;
    transition: opacity var(--transition-quick);
}

.comp-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: var(--shadow-card-hover);
}

.comp-tile:hover::before {
    opacity: 1;
}

.comp-tile h4 {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--bg-dark);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.comp-tile h4 i {
    font-size: 1rem;
    flex-shrink: 0;
}

.comp-tile p {
    font-size: 0.88rem;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.comp-tile .comp-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Режимы отображения (help-builder.html) */
.mode-switcher {
    display: flex;
    gap: 0.75rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
}

.mode-switcher .mode-option {
    flex: 1 1 220px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
}

.mode-switcher .mode-option.active {
    border-color: var(--primary-color);
    background: linear-gradient(180deg, var(--primary-soft), var(--card-bg) 60%);
}

.mode-switcher h4 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--bg-dark);
    margin-bottom: 0.3rem;
}

.mode-switcher p {
    font-size: 0.88rem;
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Подвал                                                              */
/* ------------------------------------------------------------------ */
.help-footer {
    background: linear-gradient(180deg, var(--bg-header), #0f172a);
    color: rgba(255, 255, 255, 0.72);
    padding: 2.5rem 2rem;
    text-align: center;
    border-top: 1px solid rgba(56, 189, 248, 0.2);
    margin-top: 5rem;
}

.help-footer .mb-1 {
    color: rgba(255, 255, 255, 0.9);
}

/* ------------------------------------------------------------------ */
/* Мобильная эргономика (WCAG 2.5.8)                                   */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .help-header {
        padding: 0.75rem 1rem;
    }

    .content-area {
        padding: 1.5rem 1rem 2rem 1rem;
    }

    .doc-section h1 {
        font-size: 1.45rem;
        flex-wrap: wrap;
    }

    .search-input,
    .btn-back-to-manager {
        height: 44px;
    }

    .lang-switch {
        height: 44px;
    }

    .lang-switch .lang-link {
        height: 36px;
    }

    .help-card {
        padding: 1.15rem 1.1rem;
    }
}

/* ------------------------------------------------------------------ */
/* Сворачиваемые блоки настроек компонентов                            */
/* ------------------------------------------------------------------ */
.props-details {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin: 0 0 1rem 0;
    overflow: hidden;
}

.props-details summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 44px;
    list-style: none;
    transition: background-color var(--transition-quick), color var(--transition-quick);
}

.props-details summary::-webkit-details-marker {
    display: none;
}

.props-details summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free", "FontAwesome";
    font-weight: 900;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color var(--transition-quick);
}

.props-details[open] summary::after {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.props-details summary:hover {
    background-color: #f8fafc;
    color: var(--primary-dark);
}

.props-details[open] summary {
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-dark);
}

.props-details .props-body {
    padding: 1rem 1.25rem 1.35rem 1.25rem;
}

.adv-badge {
    display: inline-block;
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    vertical-align: middle;
    white-space: nowrap;
}

.props-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0.5rem 0 1rem 0;
}
