/* ==========================================
   Management Systems Page — AI.Znaem.by
   Вариант B структура + текущий фиолетовый стиль
   ========================================== */

/* ==================== HERO ==================== */
.ms-hero {
    background: #ffffff;
    color: #1a202c;
    padding: 30px 0 60px;
    border-bottom: 1px solid #e2e8f0;
}

.ms-hero .ms-badge {
    display: inline-block;
    background: #eff6ff;
    color: #3b82f6;
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.ms-hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 12px;
}

.ms-hero .ms-sub {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 28px;
}

.ms-hero .ms-btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ms-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}

.ms-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
    color: white !important;
}

.ms-btn-outline {
    background: white;
    color: #334155;
    border: 1px solid #e2e8f0;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-btn-outline:hover {
    border-color: #667eea;
    color: #667eea;
}

/* ==================== SECTION COMMON ==================== */
.ms-section {
    padding: 60px 0;
}

.ms-section-header {
    text-align: center;
    margin-bottom: 36px;
}

.ms-section-badge {
    display: inline-block;
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
    padding: 5px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.ms-section-header h2 {
    font-size: 2.1rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.ms-section-header p {
    font-size: 1.1rem;
    color: #64748b;
}

/* ==================== PROBLEM ==================== */
.ms-problem {
    background: white;
}

.ms-problem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.ms-problem-card {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    padding: 20px;
}

.ms-problem-card h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 6px;
}

.ms-problem-card p {
    font-size: 0.95rem;
    color: #7f1d1d;
    line-height: 1.5;
    margin: 0;
}

/* ==================== SOLUTION ==================== */
.ms-solution {
    background: #f8f9fa;
}

.ms-solution-block {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 16px;
    padding: 32px;
}

.ms-solution-block h2 {
    color: #166534;
    margin-bottom: 16px;
    font-size: 1.9rem;
}

.ms-solution-block ul {
    list-style: none;
    padding: 0;
}

.ms-solution-block li {
    padding: 6px 0 6px 24px;
    position: relative;
    color: #166534;
    font-size: 1.05rem;
}

.ms-solution-block li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: 700;
}

/* ==================== CONVEYOR ==================== */
.ms-conveyor {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    padding: 28px 0 24px;
    overflow: hidden;
    border-radius: 20px;
    margin: 0;
}
.ms-conveyor-header {
    text-align: center;
    margin-bottom: 16px;
}
.ms-conveyor-header h3 {
    color: #e0e7ff;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.ms-conveyor-header p {
    color: #a5b4fc;
    font-size: 1.35rem;
    margin-top: 0;
    line-height: 1.5;
}
.conv-scene {
    max-width: 740px;
    margin: 0 auto;
    height: 120px;
    position: relative;
}
.conv-belt {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    height: 24px;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    overflow: hidden;
}
.conv-belt-inner {
    height: 100%;
    width: 200%;
    background: repeating-linear-gradient(90deg, rgba(139,92,246,0.15) 0, rgba(139,92,246,0.15) 26px, rgba(139,92,246,0.35) 26px, rgba(139,92,246,0.35) 28px);
    animation: beltMove 1s linear infinite;
}
@keyframes beltMove {
    to { transform: translateX(-28px); }
}
.conv-belt.active .conv-belt-inner {
    animation-duration: 0.35s;
}
.conv-docs {
    position: absolute;
    bottom: 44px;
    left: 0;
    right: 0;
    height: 70px;
}
.conv-doc {
    position: absolute;
    width: 42px;
    height: 58px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.48rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
}
.conv-doc.manual {
    background: rgba(139,92,246,0.08);
    border: 1px solid rgba(139,92,246,0.2);
    color: #c4b5fd;
}
.conv-doc.ai {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    border: 1px solid #c4b5fd;
    color: #fff;
    box-shadow: 0 0 20px rgba(139,92,246,0.6), 0 0 40px rgba(139,92,246,0.2);
}
.conv-doc.show { opacity: 1; }
.conv-doc.done { opacity: 0; transform: translateY(-30px); }
.conv-toggle {
    max-width: 300px;
    margin: 0 auto 12px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    height: 32px;
    background: rgba(165,180,252,0.1);
    transition: background 0.6s;
}
.conv-toggle.on { background: rgba(74,222,128,0.2); }
.conv-toggle-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #818cf8;
    transition: opacity 0.3s, transform 0.5s;
}
.conv-toggle.on .conv-toggle-label { color: #4ade80; }
.conv-toggle-label.old { opacity: 1; transform: translateX(0); }
.conv-toggle.on .conv-toggle-label.old { opacity: 0; transform: translateX(60px); }
.conv-toggle-label.new { opacity: 0; transform: translateX(-60px); }
.conv-toggle.on .conv-toggle-label.new { opacity: 1; transform: translateX(0); }
.conv-toggle-pill {
    position: absolute;
    left: 4px;
    top: 3px;
    width: 40px;
    height: 26px;
    border-radius: 13px;
    background: rgba(165,180,252,0.25);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.conv-toggle.on .conv-toggle-pill {
    left: calc(100% - 44px);
    background: #22c55e;
    box-shadow: 0 0 12px rgba(34,197,94,0.4);
}

/* ==================== CAPABILITIES ==================== */
.ms-capabilities {
    background: white;
}

.ms-cap-list {
    display: grid;
    gap: 12px;
}

.ms-cap-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-cap-item:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.08);
}

.ms-cap-num {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.ms-cap-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 4px;
}

.ms-cap-item p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* ==================== EXAMPLES ==================== */
.ms-examples {
    background: #f8f9fa;
}

.ms-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
}

.ms-tab {
    padding: 10px 22px;
    font-size: 0.85rem;
    font-weight: 600;
    background: white;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
}

.ms-tab:first-child { border-radius: 8px 0 0 8px; }
.ms-tab:last-child { border-radius: 0 8px 8px 0; }

.ms-tab.active {
    background: #1e1b4b;
    color: white;
    border-color: #1e1b4b;
}

.ms-tab:hover:not(.active) {
    background: #f1f5f9;
}

.ms-example-panel {
    display: none;
}

.ms-example-panel.active {
    display: block;
}

.ms-code-block {
    background: #1e1b4b;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ==================== AI CHAT WIDGET ==================== */
@keyframes aiTyping { 0%,100%{opacity:0.3;transform:translateY(0)} 50%{opacity:1;transform:translateY(-3px)} }
@keyframes aiBlink { 0%,100%{opacity:1} 50%{opacity:0} }

.ai-chat-widget {
    background: rgba(15,14,46,0.8);
    border: 1px solid rgba(124,58,237,0.2);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(124,58,237,0.1);
}

.ai-chat-body {
    height: 420px;
    overflow-y: auto;
    padding: 16px;
}
.ai-chat-body::-webkit-scrollbar { width: 4px; }
.ai-chat-body::-webkit-scrollbar-track { background: transparent; }
.ai-chat-body::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.2); border-radius: 2px; }

.ai-chat-body .msg { display: flex; gap: 8px; margin-bottom: 14px; }
.ai-chat-body .msg.right { flex-direction: row-reverse; }
.ai-chat-body .msg-avatar {
    width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 0.78rem;
}
.ai-chat-body .msg-avatar.ai { background: rgba(124,58,237,0.2); color: #a78bfa; border: 1px solid rgba(124,58,237,0.25); }
.ai-chat-body .msg-avatar.human { background: rgba(99,102,241,0.2); color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }
.ai-chat-body .msg-bubble {
    background: rgba(30,27,75,0.6); border: 1px solid rgba(124,58,237,0.1);
    border-radius: 12px; padding: 10px 14px;
    font-size: 0.78rem; line-height: 1.55; max-width: 85%;
    min-height: 20px; color: #e2e8f0;
}
.ai-chat-body .msg.right .msg-bubble { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.15); }

.ai-chat-body .typing-dots { display: flex; gap: 3px; padding: 3px 0; }
.ai-chat-body .typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: #7c3aed; animation: aiTyping 1s infinite; }
.ai-chat-body .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-body .typing-dots span:nth-child(3) { animation-delay: 0.3s; }

.ai-chat-body .cursor { display: inline-block; width: 2px; height: 1em; background: #a78bfa; animation: aiBlink 0.7s infinite; vertical-align: text-bottom; margin-left: 1px; }

.ai-chat-input {
    border-top: 1px solid rgba(124,58,237,0.1);
    padding: 10px 16px; display: flex; gap: 8px; align-items: center;
}
.ai-chat-input-field { flex: 1; background: rgba(30,27,75,0.4); border: 1px solid rgba(124,58,237,0.12); border-radius: 10px; padding: 8px 12px; color: #475569; font-size: 0.78rem; }
.ai-chat-input-btn { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #7c3aed, #6366f1); display: flex; align-items: center; justify-content: center; color: white; font-size: 0.85rem; }

.ms-code-label {
    font-family: system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #60a5fa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: block;
}

/* ==================== MODES ==================== */
.ms-modes {
    background: white;
}

.ms-modes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ms-mode-card {
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.ms-mode-card.cloud {
    border-color: #86efac;
    background: linear-gradient(to bottom, #f0fdf4, white);
}

.ms-mode-card.local {
    border-color: #c7d2fe;
    background: linear-gradient(to bottom, #eef2ff, white);
}

.ms-mode-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.ms-mode-price {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 8px 0;
}

.ms-mode-card.cloud .ms-mode-price { color: #16a34a; }
.ms-mode-card.local .ms-mode-price { color: #667eea; }

.ms-mode-card > p {
    font-size: 1.15rem;
    font-weight: 600;
    color: #475569;
}

.ms-mode-card ul {
    list-style: none;
    padding: 0;
    text-align: left;
    margin-top: 12px;
}

.ms-mode-card li {
    padding: 4px 0 4px 20px;
    font-size: 0.95rem;
    color: #475569;
    position: relative;
}

.ms-mode-card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: 700;
}

/* ==================== FAQ ==================== */
.ms-faq {
    background: #f8f9fa;
}

.ms-faq-list {
    margin: 0 auto;
}

.ms-faq-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ms-faq-q {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a202c;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ms-faq-arrow {
    transition: transform 0.3s ease;
    color: #667eea;
    font-size: 0.8rem;
}

.ms-faq-item.open .ms-faq-arrow {
    transform: rotate(180deg);
}

.ms-faq-a {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
    margin-top: 10px;
    display: none;
}

.ms-faq-item.open .ms-faq-a {
    display: block;
}

/* ==================== CTA ==================== */
.ms-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.ms-cta h2 {
    font-size: 2.3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.ms-cta p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.ms-cta .ms-cta-btn {
    display: inline-block;
    background: white;
    color: #764ba2;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    margin-top: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-cta .ms-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==================== EDITABLE LINKS (no underline) ==================== */
.ms-hero a[data-editable-href]:not(.ms-btn-primary):not(.ms-btn-outline),
.ms-problem a[data-editable-href],
.ms-solution a[data-editable-href],
.ms-capabilities a[data-editable-href],
.ms-examples a[data-editable-href],
.ms-modes a[data-editable-href],
.ms-faq a[data-editable-href],
.ms-cta a[data-editable-href]:not(.ms-cta-btn) {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.ms-hero a[data-editable-href]:not(.ms-btn-primary):not(.ms-btn-outline):hover,
.ms-problem a[data-editable-href]:hover,
.ms-solution a[data-editable-href]:hover,
.ms-capabilities a[data-editable-href]:hover,
.ms-examples a[data-editable-href]:hover,
.ms-modes a[data-editable-href]:hover,
.ms-faq a[data-editable-href]:hover,
.ms-cta a[data-editable-href]:hover {
    color: #667eea;
}

/* buttons keep their own styles */
.ms-btn-outline {
    color: #334155 !important;
}
.ms-cta-btn {
    color: #764ba2 !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    /* Hero */
    .ms-hero { padding: 20px 0 40px; }
    .ms-hero .ms-badge { font-size: 0.8rem; padding: 5px 14px; margin-bottom: 14px; }
    .ms-hero h1 { font-size: 1.6rem; margin-bottom: 10px; }
    .ms-hero .ms-sub { font-size: 1rem; margin-bottom: 20px; }
    .ms-hero .ms-btns { flex-direction: column; }
    .ms-btn-primary, .ms-btn-outline { width: 100%; text-align: center; padding: 12px 20px; font-size: 0.95rem; }

    /* Conveyor */
    .ms-conveyor { border-radius: 14px; padding: 24px 12px; }
    .ms-conveyor-header { margin-bottom: 20px; padding: 0 4px; }
    .ms-conveyor-header p { font-size: 0.88rem; line-height: 1.4; }
    .conv-scene { height: 120px; margin: 0 6px; max-width: 100%; }
    .conv-doc { width: 30px; height: 42px; font-size: 0.4rem; }
    .conv-belt { height: 18px; bottom: 16px; left: 0; right: 0; }
    .conv-docs { bottom: 38px; height: 60px; left: 0; right: 0; }
    .conv-toggle { max-width: 240px; height: 28px; }
    .conv-toggle-pill { width: 34px; height: 22px; top: 3px; left: 3px; }
    .conv-toggle.on .conv-toggle-pill { left: calc(100% - 37px); }
    .conv-toggle-label { font-size: 0.7rem; }

    /* Sections */
    .ms-section { padding: 40px 0; }
    .ms-section-header { margin-bottom: 24px; }
    .ms-section-badge { font-size: 0.75rem; padding: 4px 12px; }
    .ms-section-header h2 { font-size: 1.45rem; }
    .ms-section-header p { font-size: 0.95rem; }

    /* Problem */
    .ms-problem-grid { grid-template-columns: 1fr; gap: 10px; }
    .ms-problem-card { padding: 16px; }
    .ms-problem-card h4 { font-size: 0.95rem; }
    .ms-problem-card p { font-size: 0.88rem; }

    /* Solution */
    .ms-solution-block { padding: 20px; }
    .ms-solution-block h2 { font-size: 1.4rem; margin-bottom: 12px; }
    .ms-solution-block li { font-size: 0.92rem; padding: 5px 0 5px 22px; }

    /* Capabilities */
    .ms-cap-item { padding: 14px; gap: 12px; }
    .ms-cap-num { width: 34px; height: 34px; font-size: 0.85rem; border-radius: 8px; }
    .ms-cap-item h4 { font-size: 0.98rem; }
    .ms-cap-item p { font-size: 0.9rem; }

    /* Examples */
    .ms-tabs { flex-wrap: wrap; }
    .ms-tab { flex: 1 1 auto; min-width: 0; text-align: center; font-size: 0.72rem; padding: 8px 6px; word-break: break-word; overflow: hidden; }
    .ms-code-block { padding: 16px; font-size: 0.82rem; line-height: 1.55; overflow-x: auto; }
    .ai-chat-body { height: 320px; }
    .ai-chat-body .msg-bubble { font-size: 0.72rem; max-width: 90%; }

    /* Modes */
    .ms-modes-grid { grid-template-columns: 1fr; gap: 14px; }
    .ms-mode-card { padding: 20px; }
    .ms-mode-card h3 { font-size: 1.1rem; }
    .ms-mode-price { font-size: 1.25rem; }
    .ms-mode-card > p { font-size: 1rem; }
    .ms-mode-card li { font-size: 0.88rem; }

    /* FAQ */
    .ms-faq-item { padding: 16px; }
    .ms-faq-q { font-size: 0.95rem; }
    .ms-faq-a { font-size: 0.9rem; }

    /* CTA */
    .ms-cta { padding: 40px 0; }
    .ms-cta h2 { font-size: 1.6rem; }
    .ms-cta p { font-size: 0.92rem; }
    .ms-cta .ms-cta-btn { padding: 12px 28px; font-size: 0.95rem; }
}

@media (max-width: 400px) {
    .ms-hero h1 { font-size: 1.35rem; }
    .ms-conveyor-header p { font-size: 0.82rem; }
    .ms-section-header h2 { font-size: 1.25rem; }
    .conv-scene { height: 100px; margin: 0 4px; }
    .conv-doc { width: 26px; height: 36px; font-size: 0.36rem; }
    .conv-belt { height: 14px; bottom: 12px; }
    .conv-docs { bottom: 30px; height: 50px; }
    .conv-toggle { max-width: 200px; height: 26px; }
    .conv-toggle-pill { width: 30px; height: 20px; }
    .conv-toggle.on .conv-toggle-pill { left: calc(100% - 34px); }
    .conv-toggle-label { font-size: 0.65rem; }
    .ms-hero .ms-sub { font-size: 0.9rem; }
    .ms-hero .ms-badge { font-size: 0.7rem; padding: 4px 12px; }
    .ms-section { padding: 30px 0; }
    .ms-problem-card { padding: 14px; }
    .ms-solution-block { padding: 16px; }
    .ms-solution-block li { font-size: 0.85rem; }
    .ms-mode-card { padding: 16px; }
    .ms-mode-card li { font-size: 0.82rem; }
    .ms-faq-item { padding: 14px; }
    .ms-cta h2 { font-size: 1.3rem; }
    .ms-cta .ms-cta-btn { padding: 10px 20px; font-size: 0.9rem; }
}
