/* === АИС «Медвеженок» — Портал поддержки === */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --indigo-900: #1e1b4b;
    --indigo-800: #312e81;
    --indigo-700: #4338ca;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* === Header === */
.support-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}
.support-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.support-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--indigo-900);
}
.support-logo svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}
.support-nav {
    display: flex;
    gap: 28px;
    flex: 1;
    justify-content: center;
}
.support-nav a {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: all .2s;
}
.support-nav a:hover,
.support-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.support-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn svg { width: 16px; height: 16px; }

/* === Main === */
.support-main { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; }

/* === Hero === */
.support-hero {
    background: linear-gradient(135deg, var(--indigo-900) 0%, var(--indigo-700) 100%);
    border-radius: var(--radius);
    padding: 60px 40px;
    margin: 32px 0;
    text-align: center;
    color: #fff;
}
.support-hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}
.support-hero p {
    font-size: 16px;
    opacity: .85;
    margin-bottom: 28px;
}
.support-search {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    background: #fff;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.support-search input {
    flex: 1;
    border: none;
    padding: 16px 20px;
    font-size: 15px;
    outline: none;
    font-family: var(--font);
}
.support-search button {
    width: 56px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.support-search button:hover { background: var(--primary-dark); }
.support-search button svg { width: 20px; height: 20px; }

/* === Sections === */
.support-section { margin-top: 48px; }
.support-section h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--gray-900);
}

/* === Categories === */
.support-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.support-category-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    transition: all .2s;
    cursor: pointer;
}
.support-category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.category-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.category-icon svg { width: 22px; height: 22px; color: var(--primary); }
.support-category-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-900);
}
.support-category-card p {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.5;
}

/* === Topics List === */
.support-topics-list {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}
.support-topic-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    transition: background .2s;
}
.support-topic-item:last-child { border-bottom: none; }
.support-topic-item:hover { background: var(--gray-50); }
.topic-icon {
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.topic-icon svg { width: 18px; height: 18px; color: var(--gray-500); }
.topic-info { flex: 1; min-width: 0; }
.topic-info h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topic-category {
    font-size: 12px;
    color: var(--gray-400);
}
.topic-views {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-400);
    flex-shrink: 0;
}
.topic-views svg { width: 14px; height: 14px; }
.topic-date {
    font-size: 12px;
    color: var(--gray-400);
    flex-shrink: 0;
}

/* === Contact === */
.support-contact {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
    margin-top: 48px;
}
.support-contact h2 {
    font-size: 24px;
    margin-bottom: 8px;
}
.support-contact p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* === Footer === */
.support-footer {
    text-align: center;
    padding: 32px;
    color: var(--gray-400);
    font-size: 13px;
    border-top: 1px solid var(--gray-200);
}

/* === Chat Widget === */
.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: all .3s ease;
}
.chat-widget-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}
.chat-widget-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--indigo-900) 0%, var(--indigo-700) 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.chat-widget-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 280px;
    max-height: 380px;
}
.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}
.chat-message-user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-message-admin {
    align-self: flex-start;
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}
.chat-message-system {
    align-self: center;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 12px;
    text-align: center;
    max-width: 100%;
}
.chat-message-time {
    font-size: 10px;
    opacity: .6;
    margin-top: 4px;
}
.chat-widget-input {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    gap: 8px;
}
.chat-widget-input input {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    outline: none;
    font-family: var(--font);
}
.chat-widget-input input:focus { border-color: var(--primary); }
.chat-widget-input button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-widget-input button:hover { background: var(--primary-dark); }
.chat-widget-input button svg { width: 16px; height: 16px; }
.chat-file-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
}
.chat-file-btn:hover { background: var(--gray-300); color: var(--gray-800); }
.chat-file-btn svg { width: 16px; height: 16px; }
.chat-image-thumb {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 6px;
    cursor: pointer;
    border: 1px solid var(--gray-200);
}
.chat-image-thumb:hover { opacity: .9; }

/* === Chat Toggle === */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--indigo-900) 0%, var(--indigo-700) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transition: transform .2s;
}
.chat-toggle:hover { transform: scale(1.05); }
.chat-toggle svg { width: 24px; height: 24px; }
.chat-toggle-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* === Admin Layout === */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--gray-50);
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--indigo-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
}
.admin-sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar-header a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
}
.admin-sidebar-header svg { width: 24px; height: 24px; }
.admin-sidebar-nav { flex: 1; padding: 16px 12px; }
.admin-sidebar-nav ul { list-style: none; }
.admin-sidebar-nav li { margin-bottom: 4px; }
.admin-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    transition: all .2s;
}
.admin-sidebar-nav a:hover,
.admin-sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.admin-sidebar-nav svg { width: 18px; height: 18px; }
.admin-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}
.admin-sidebar-footer a {
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all .2s;
}
.admin-sidebar-footer a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
}
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.top-bar h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 24px;
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.orange { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon svg { width: 22px; height: 22px; }
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
.data-table th {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
}
.data-table tr:hover { background: var(--gray-50); }
.data-table tr[data-clickable] { cursor: pointer; }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-open { background: #d1fae5; color: #065f46; }
.status-closed { background: #e5e7eb; color: #374151; }

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-group input { width: auto; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--gray-400);
}
.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: .5;
}

/* Topic Page */
.topic-page { max-width: 800px; margin: 0 auto; }
.topic-header {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 32px;
    margin-bottom: 24px;
}
.topic-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}
.topic-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
}
.topic-content {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 32px;
    line-height: 1.8;
}
.topic-content h2 { font-size: 20px; margin: 24px 0 12px; }
.topic-content h3 { font-size: 18px; margin: 20px 0 10px; }
.topic-content p { margin-bottom: 12px; }
.topic-content ul, .topic-content ol { margin-bottom: 12px; padding-left: 24px; }
.topic-content li { margin-bottom: 6px; }
.topic-content code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}
.topic-content pre {
    background: var(--gray-900);
    color: #fff;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .support-header-inner { padding: 0 16px; }
    .support-nav { display: none; }
    .support-hero { padding: 40px 20px; }
    .support-hero h1 { font-size: 26px; }
    .support-main { padding: 0 16px 40px; }
    .support-categories { grid-template-columns: 1fr; }
    .chat-widget { width: calc(100% - 32px); right: 16px; bottom: 80px; }
    .admin-sidebar { width: 100%; position: relative; height: auto; }
    .main-content { margin-left: 0; }
    .admin-layout { flex-direction: column; }
}
