/**
 * Стили для Wiki интерфейса
 * Совместное редактирование статей
 */

/* Основной контейнер Wiki интерфейса */
.wiki-interface {
    border-radius: 8px;
    overflow: hidden;
}

.wiki-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    color: white;
    flex-wrap: wrap;
}

.wiki-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.wiki-label {
    font-weight: 600;
    font-size: 16px;
    margin-left: 8px;
}

.wiki-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 13px;
    backdrop-filter: blur(10px);
}

.wiki-stat i {
    font-size: 12px;
    opacity: 0.9;
}

.wiki-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Кнопки Wiki */
.wiki-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    backdrop-filter: blur(10px);
}

.wiki-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wiki-btn:active {
    transform: translateY(0);
}

.wiki-btn-edit {
    background: rgba(46, 204, 113, 0.3);
    border-color: rgba(46, 204, 113, 0.5);
}

.wiki-btn-edit:hover {
    background: rgba(46, 204, 113, 0.5);
}

.wiki-btn-history {
    background: rgba(52, 152, 219, 0.3);
    border-color: rgba(52, 152, 219, 0.5);
}

.wiki-btn-history:hover {
    background: rgba(52, 152, 219, 0.5);
}

.wiki-btn-settings {
    background: rgba(149, 165, 166, 0.3);
    border-color: rgba(149, 165, 166, 0.5);
}

.wiki-btn-settings:hover {
    background: rgba(149, 165, 166, 0.5);
}

/* Модальные окна Wiki */
.wiki-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.wiki-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.wiki-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    border-bottom: 1px solid #e1e8ed;
}

.wiki-modal-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.wiki-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.wiki-modal-close:hover {
    background-color: #f8f9fa;
}

.wiki-modal-body {
    padding: 15px;
}

/* Стили для управления соавторами */
.collaborators-section {
    margin-bottom: 30px;
}

.collaborators-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.collaborators-list {
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.collaborator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f1f2f6;
}

.collaborator-item:last-child {
    border-bottom: none;
}

.collaborator-info {
    flex: 1;
}

.collaborator-info strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 5px;
}

.permission-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 10px;
}

.permission-level.viewer {
    background: #e3f2fd;
    color: #1976d2;
}

.permission-level.editor {
    background: #e8f5e8;
    color: #388e3c;
}

.permission-level.admin {
    background: #fff3e0;
    color: #f57c00;
}

.collaborator-info small {
    color: #7f8c8d;
    font-size: 11px;
}

.no-collaborators {
    text-align: center;
    color: #7f8c8d;
    padding: 30px;
    font-style: italic;
}

.add-collaborator-section {
    border-top: 1px solid #e1e8ed;
    padding-top: 20px;
}

.add-collaborator-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dce7ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-outline-danger {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.btn-outline-danger:hover {
    background: #e74c3c;
    color: white;
}

/* Wiki Editor */
.wiki-editor {
    width: 100%;
}

.wiki-editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    flex-wrap: wrap;
}

.wiki-toolbar-btn {
    padding: 6px 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.wiki-toolbar-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.wiki-editor-textarea {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 0 0 6px 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
}

.wiki-editor-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.wiki-editor-footer {
		display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid #dee2e6;
    margin-top: 20px;
    flex-wrap: wrap;
}

.wiki-summary-group {
    flex: 1;
    margin-right: 20px;
}

.wiki-summary-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
}

.wiki-editor-actions {
    display: flex;
    gap: 10px;
}

.wiki-save-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.wiki-save-btn:hover {
    background: #218838;
}

.wiki-cancel-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.wiki-cancel-btn:hover {
    background: #5a6268;
}

/* Wiki History */
.wiki-history-list {
    max-height: 60vh;
    overflow-y: auto;
}

/* Кнопка закрытия только окна ревизии (не истории) */
.wiki-revision-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.wiki-revision-close-btn:hover {
    color: #333;
}

.wiki-revision-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.wiki-revision-item:hover {
    background: #f8f9fa;
}

.wiki-revision-info {
    flex: 1;
}

.wiki-revision-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

.wiki-revision-number {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.wiki-revision-author {
    font-weight: 500;
    color: #495057;
}

.wiki-revision-date {
    color: #6c757d;
    font-size: 13px;
}

.wiki-revision-summary {
    color: #6c757d;
    font-size: 14px;
    font-style: italic;
}

.wiki-revision-actions {
    display: flex;
    gap: 8px;
}

.wiki-revision-btn {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #28a745;
}

.wiki-revision-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #037c1e;
}

.wiki-revision-btn.view {
    color: #17a2b8;
    border-color: #17a2b8;
}

.wiki-revision-btn.revert {
    color: #dc3545;
    border-color: #dc3545;
}

/* ===== DIFF VIEWER ===== */
.wiki-diff-modal { max-width: 960px; width: 95%; }
.diff-mode-switch { display:flex; gap:8px; margin-bottom:15px; }
.diff-mode-btn { padding:6px 12px; border:1px solid #d0d7de; background:#3498db; border-radius:4px; cursor:pointer; font-size:13px; }
.diff-mode-btn.active { background:#0366d6; color:#fff; border-color:#0366d6; }
.wiki-diff-container { font-family:monospace; font-size:13px; line-height:1.4; max-height:60vh; overflow:auto; border:1px solid #e1e4e8; background:#fff; }
.diff-line { padding:2px 8px; white-space:pre-wrap; }
.diff-line.diff-added { background:#e6ffed; color:#22863a; }
.diff-line.diff-removed { background:#ffeef0; color:#cb2431; }
.diff-line.diff-unchanged { background:#fff; color:#24292e; }
.diff-title-change { background:#fff8c5; border:1px solid #e1e4e8; padding:8px 10px; border-radius:6px; margin-bottom:12px; font-family:system-ui,sans-serif; }
.diff-title-change .old { text-decoration:line-through; color:#cb2431; }
.diff-title-change .new { color:#22863a; font-weight:600; }
/* Side-by-side */
.diff-table { width:100%; border-collapse:collapse; font-family:monospace; }
.diff-table td { vertical-align:top; padding:2px 6px; border-right:1px solid #e1e4e8; }
.diff-table td.old-num, .diff-table td.new-num { width:50px; background:#f6f8fa; color:#6a737d; text-align:right; font-size:12px; }
.diff-table tr.diff-added td.new { background:#e6ffed; }
.diff-table tr.diff-removed td.old { background:#ffeef0; }
.diff-table tr.diff-unchanged td { background:#fff; }
.wiki-diff-container.diff-mode-side { padding:0; }
.wiki-empty-diff { padding:15px; text-align:center; color:#6a737d; }
/* Scrollbar minor tweak */
.wiki-diff-container::-webkit-scrollbar { width:10px; }
.wiki-diff-container::-webkit-scrollbar-thumb { background:#c4cdda; border-radius:5px; }

/* Предупреждения и уведомления */
.wiki-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.wiki-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 8px 0;
}

.wiki-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
}

/* Блокировка редактирования */
.wiki-edit-lock {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wiki-edit-lock i {
    font-size: 18px;
}

/* Базовая раскладка статистики */
.wiki-stats { display:flex; flex-wrap:wrap; gap:8px; }

/* Адаптив: компактный режим для мобильных */
@media (max-width: 768px) {
  .wiki-interface { margin: 12px 0; border-radius: 10px; }
  .wiki-status-bar { flex-direction: column; align-items: stretch; gap: 2px; padding: 4px 8px; }
  .wiki-info { flex-direction: column; align-items: flex-start; gap: 4px; }
  .wiki-label { font-size: 14px; margin-left: 0; }
  .wiki-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .wiki-stat { justify-content: center; padding: 6px 8px; font-size: 12px; border-radius: 10px; }
  .wiki-actions { gap: 8px; }
  .wiki-btn { padding: 8px 10px; font-size: 13px; border-radius: 8px; }
  .wiki-btn i { font-size: 16px; }
  .wiki-btn .wiki-btn-label { display: none; }
}

@media (max-width: 480px) {
  .wiki-status-bar { padding: 0; gap: 4px; }
  .wiki-stat { font-size: 11px; padding: 6px 8px; }
  .wiki-btn { padding: 8px; font-size: 0; /* скрыть текст, если нет .wiki-btn-label */ }
  .wiki-btn i { font-size: 18px; margin: 0; }
}

/* Ultra-compact mobile cleanup: no extra paddings, borders, or background */
@media (max-width: 640px) {
  .wiki-interface { background: none !important; box-shadow: none !important; margin: 8px 0; border-radius: 8px; overflow: visible; }
  .wiki-status-bar { padding: 0; color: #111827; gap: 4px; }
  .wiki-info { gap: 4px; }
  .wiki-label { font-size: 13px; margin-left: 0; color: #111827; }
  .wiki-stats { grid-template-columns: 1fr 1fr; gap: 4px; }
  .wiki-stat { background: transparent; padding: 4px 6px; border: 0; backdrop-filter: none; }
  .wiki-stat i { opacity: 0.8; }
  .wiki-actions { gap: 6px; }
  .wiki-btn { background: transparent; border: 0; padding: 8px; font-size: 0; box-shadow: none; }
  .wiki-btn i { font-size: 18px; margin: 0; }
}

/* Анимации */
@keyframes wiki-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wiki-interface {
    animation: wiki-slide-in 0.3s ease-out;
}

.wiki-revision-item {
    opacity: 0;
    animation: wiki-slide-in 0.3s ease-out forwards;
}

.wiki-revision-item:nth-child(1) { animation-delay: 0.1s; }
.wiki-revision-item:nth-child(2) { animation-delay: 0.2s; }
.wiki-revision-item:nth-child(3) { animation-delay: 0.3s; }
.wiki-revision-item:nth-child(4) { animation-delay: 0.4s; }
.wiki-revision-item:nth-child(5) { animation-delay: 0.5s; }

/* Стили для управления соавторами */
.add-collaborator-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    color: #6c757d;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-btn:hover {
    background-color: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.available-users-list, .available-groups-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.available-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.available-item:hover {
    background-color: #f8f9fa;
}

.available-item:last-child {
    border-bottom: none;
}

.user-info, .group-info {
    flex: 1;
}

.user-info strong, .group-info strong {
    display: block;
    color: #495057;
    margin-bottom: 4px;
}

.user-info small, .group-info small {
    color: #6c757d;
    font-size: 12px;
}

.add-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.add-controls select {
    min-width: 120px;
    padding: 5px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
}

.collaborator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 10px;
    background-color: #fff;
    transition: box-shadow 0.2s ease;
}

.collaborator-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.collaborator-info {
    flex: 1;
}

.collaborator-info strong {
    display: block;
    color: #495057;
    margin-bottom: 5px;
}

.permission-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.permission-level.view {
    background-color: #d1ecf1;
    color: #0c5460;
}

.permission-level.edit {
    background-color: #d4edda;
    color: #155724;
}

.permission-level.admin {
    background-color: #f8d7da;
    color: #721c24;
}

.collaborator-info small {
    color: #6c757d;
    font-size: 12px;
}

.collaborator-actions {
    display: flex;
    gap: 8px;
}

.no-collaborators {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    margin: 0;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Diff & Comparison Styles === */
.wiki-compare-panel {margin-bottom:15px;padding:10px;background:#f1f5f9;border:1px solid #dce3ea;border-radius:6px;display:flex;flex-wrap:wrap;align-items:center;gap:12px;justify-content:space-between;font-size:13px;}
.wiki-compare-panel .compare-actions {display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
.wiki-compare-panel select {padding:4px 8px;font-size:13px;}
.wiki-compare-panel label {display:flex;align-items:center;gap:4px;cursor:pointer;font-weight:500;color:#34495e;}
.wiki-compare-panel .wiki-revision-btn.compare-run {background:#2563eb;color:#fff;border:none;}
.wiki-compare-panel .wiki-revision-btn.compare-run:disabled {background:#94a3b8;cursor:not-allowed;}

.wiki-revision-item {position:relative;}
.wiki-revision-select {margin-right:10px;}
.wiki-revision-item .wiki-compare-checkbox {width:16px;height:16px;cursor:pointer;}

/* Diff Modal */
#wiki-diff-modal .wiki-modal-content {max-width:1100px;width:95%;}
.wiki-diff-meta {display:flex;flex-direction:column;gap:4px;margin-bottom:12px;font-size:13px;color:#475569;}
.wiki-diff-meta .diff-label-old {color:#dc2626;font-weight:600;}
.wiki-diff-meta .diff-label-new {color:#16a34a;font-weight:600;}
.wiki-diff-meta .diff-mode-indicator {font-style:italic;color:#64748b;}

/* Unified view */
.wiki-diff-unified {font-family:Menlo,Consolas,monospace;font-size:13px;line-height:1.45;border:1px solid #e2e8f0;background:#fff;border-radius:6px;overflow:auto;max-height:70vh;padding:8px;}
.wiki-diff-line {padding:2px 6px;border-left:4px solid transparent;white-space:pre-wrap;word-break:break-word;}
.wiki-diff-line.diff-added {background:#f0fdf4;border-color:#16a34a;}
.wiki-diff-line.diff-removed {background:#fef2f2;border-color:#dc2626;}
.wiki-diff-line.diff-changed {background:#fff7ed;border-color:#f59e0b;}
.wiki-diff-line.diff-unchanged {color:#64748b;opacity:.65;}

/* Side-by-side */
.wiki-diff-side {display:flex;flex-direction:column;gap:0;border:1px solid #e2e8f0;border-radius:6px;overflow:auto;max-height:70vh;}
.wiki-diff-row {display:grid;grid-template-columns:1fr 1fr;font-family:Menlo,Consolas,monospace;font-size:13px;line-height:1.45;border-bottom: 1px solid #f1f5f9;}
.wiki-diff-row:nth-child(odd) {background:#f8fafc;}
.wiki-diff-row.diff-added {background:#f0fdf4;}
.wiki-diff-row.diff-removed {background:#fef2f2;}
.wiki-diff-row.diff-changed {background:#fff7ed;}

.diff-col {padding:4px 8px;border-left:4px solid transparent;white-space:pre-wrap;word-break:break-word;min-height: 1.5em;}
.wiki-diff-row.diff-added .diff-new {border-color:#16a34a; background: #e6ffed;}
.wiki-diff-row.diff-removed .diff-old {border-color:#dc2626; background: #ffeef0;}

.wiki-diff-row.diff-changed .diff-old {border-color:#dc2626; background: #ffeef0;}
.wiki-diff-row.diff-changed .diff-new {border-color:#16a34a; background: #e6ffed;}

.wiki-diff-row.diff-unchanged .diff-col { opacity: 0.8; }

/* Inline char diff */
.diff-char-added {background:#bbf7d0;color:#065f46;border-radius:2px;padding:0 1px;}
.diff-char-removed {background:#fecaca;color:#7f1d1d;border-radius:2px;padding:0 1px;}
.inline-old, .inline-new {display:block;}
.inline-old {color:#b91c1c;}
.inline-new {color:#065f46;}

/* Empty diff */
.wiki-empty-diff {padding:20px;text-align:center;color:#64748b;background:#f8fafc;border:1px dashed #cbd5e1;border-radius:6px;}

/* Fold indicator could be added later */

/* Footer buttons */
#wiki-diff-modal .wiki-modal-footer {display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;margin: 15px;}
#wiki-diff-modal .wiki-modal-footer .wiki-revision-btn {background:#475569;color:#fff;}
#wiki-diff-modal .wiki-modal-footer .wiki-revision-btn:hover {background:#1e293b;}

.wiki-status.active{
    margin-bottom: 15px;
}

/* Стили для diff в просмотре ревизии */
.wiki-revision-diff-info {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 14px;
    color: #0d47a1;
}

.wiki-revision-diff-info i {
    margin-right: 8px;
}

.wiki-revision-diff {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    max-height: 400px;
    overflow: auto;
    white-space: pre-wrap;
}

.wiki-diff-line {
    margin: 2px 0;
    padding: 2px 0;
}

.wiki-diff-line.diff-added {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.wiki-diff-line.diff-removed {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
}

.wiki-diff-line.diff-changed {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.wiki-diff-line.diff-unchanged {
    background: transparent;
}

.diff-added-line {
    color: #155724;
}

.diff-removed-line {
    color: #721c24;
}

.diff-changed-line {
    color: #856404;
}

.diff-marker {
    font-weight: bold;
    margin-right: 8px;
}

.diff-char-added {
    background: #d4edda;
    color: #155724;
    padding: 1px 2px;
    border-radius: 2px;
}

.diff-char-removed {
    background: #f8d7da;
    color: #721c24;
    padding: 1px 2px;
    border-radius: 2px;
}

.wiki-stats {
    display: flex;
}


/**/
/* Стили для уведомлений о конфликте редактирования */

/* === AJAX User Search Styles === */
.user-search-container {
    margin-bottom: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 15px;
}

.search-input-container {
    position: relative;
    margin-bottom: 10px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 14px;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 6px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e9ecef;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.search-result-item:hover {
    background: #f8f9fa;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.search-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    color: #6c757d;
    font-size: 20px;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.search-result-name mark {
    background: #fff3cd;
    color: #856404;
    padding: 1px 3px;
    border-radius: 3px;
}

.search-result-email {
    font-size: 12px;
    color: #6c757d;
}

.search-result-action {
    color: #28a745;
    font-size: 18px;
    margin-left: 12px;
}

.search-loading {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-loading i {
    margin-right: 8px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-no-results i {
    margin-right: 8px;
    font-size: 18px;
}

.search-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
    text-align: center;
}

.search-error i {
    margin-right: 8px;
}

.wiki-stats {
    display: flex;
}

/* === AJAX User Search Interface Styles === */
.user-search-container {
    margin-bottom: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 15px;
}

.search-input-container {
    position: relative;
    margin-bottom: 10px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 14px;
}

.search-loading {
    text-align: center;
    padding: 10px;
    color: #6c757d;
    font-size: 14px;
}

.search-loading i {
    margin-right: 8px;
    color: #3498db;
}

.search-results {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
}

.search-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.search-placeholder i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
    color: #dee2e6;
}

.search-placeholder p {
    margin: 0;
    font-size: 14px;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-user-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.search-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.search-user-details {
    flex: 1;
}

.search-user-name {
    font-weight: 500;
    color: #212529;
    margin: 0 0 2px 0;
    font-size: 14px;
}

.search-user-email {
    color: #6c757d;
    font-size: 12px;
    margin: 0;
}

.search-user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-permission-select {
    padding: 4px 8px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
}

.search-add-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 70px;
}

.search-add-btn:hover {
    background: #218838;
}

.search-add-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.search-no-results {
    text-align: center;
    padding: 30px 20px;
    color: #6c757d;
}

.search-no-results i {
    font-size: 20px;
    margin-bottom: 8px;
    display: block;
    color: #dee2e6;
}

/* Подсветка совпадений в результатах поиска */
.search-result-item mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* Стили для результатов поиска в wiki-manage.js */
.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    flex-shrink: 0;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-avatar i {
    font-size: 18px;
    color: #6c757d;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 500;
    color: #212529;
    margin: 0 0 2px 0;
    font-size: 14px;
}

.search-result-email {
    color: #6c757d;
    font-size: 12px;
    margin: 0;
}

.search-result-action {
    color: #28a745;
    font-size: 16px;
    flex-shrink: 0;
}

.search-result-action:hover {
    color: #218838;
}

/* Дополнительные стили для индикаторов */
.search-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
}

.search-loading i {
    margin-right: 8px;
    color: #3498db;
}

.search-no-results {
    text-align: center;
    padding: 30px 20px;
    color: #6c757d;
}

.search-no-results i {
    font-size: 20px;
    margin-bottom: 8px;
    display: block;
    color: #dee2e6;
}

/*MY CSS */

button:hover {
    background-color: #eeeeee;
    color: inherit;
}
/*END MY CSS*/

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .search-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-user-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .search-permission-select {
        flex: 1;
        margin-right: 10px;
    }
}
