/* ============================================
   ОБЩИЕ СТИЛИ
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

/* ========================================
   Шапка сайта
   ======================================== */
.site-header {
    background: #1e3a5f;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
}

.company-logo {
    height: 45px;
}

.company-name {
    color: #ffffff;
    font-size: 20px;
    margin: 0;
}

.company-slogan {
    color: #a8c4e0;
    font-size: 13px;
    margin: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user > span {
    color: #d0e2f2;
    font-size: 14px;
    font-weight: 500;
}

/* ========================================
   Кнопки — общий стиль
   ======================================== */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    text-align: center;
}

/* Маленькие кнопки (в шапке) */
.btn-small {
    padding: 8px 18px;
    font-size: 14px;
}

/* ========================================
   Кнопка "Админка" — яркая, заметная
   ======================================== */
.btn-small:not(.btn-outline):not(.btn-primary):not(.btn-users) {
    background: #f9a825;
    color: #1e3a5f;
    border: 2px solid #f9a825;
}

.btn-small:not(.btn-outline):not(.btn-primary):not(.btn-users):hover {
    background: #fbc02d;
    border-color: #fbc02d;
    box-shadow: 0 2px 8px rgba(249, 168, 37, 0.4);
    transform: translateY(-1px);
}

/* ========================================
   Кнопка "Выход" — контрастная на тёмном фоне
   ======================================== */
.btn-outline {
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
}

.btn-outline:hover {
    background: #ffffff;
    color: #1e3a5f;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ========================================
   Основная кнопка (Найти, Сохранить и т.д.)
   ======================================== */
.btn-primary {
    background: #2196F3;
    color: #ffffff;
    border: 2px solid #2196F3;
}

.btn-primary:hover {
    background: #1976D2;
    border-color: #1976D2;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
    transform: translateY(-1px);
}

/* Полноширинная кнопка (на странице логина) */
.btn-full {
    width: 100%;
}

/* ========================================
   Кнопка "Пользователи"
   ======================================== */
.btn-users {
    background: #7c4dff;
    color: #ffffff;
    border: 2px solid #7c4dff;
}

.btn-users:hover {
    background: #651fff;
    border-color: #651fff;
    box-shadow: 0 2px 8px rgba(124, 77, 255, 0.4);
    transform: translateY(-1px);
}

/* ============================================
   СТРАНИЦА ВХОДА
   ============================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 5px;
    color: #1e3a5f;
    font-size: 24px;
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

/* ============================================
   ФОРМЫ
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 12px;
}

.form-group input[type="file"] {
    padding: 10px;
    font-size: 14px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* ============================================
   СООБЩЕНИЯ
   ============================================ */
.error-message {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #dc2626;
    font-size: 14px;
}

.success-message {
    background-color: #f0fdf4;
    color: #16a34a;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #16a34a;
    font-size: 14px;
}

/* ============================================
   ПОИСК
   ============================================ */
.search-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 25px;
}

.search-section h2 {
    margin-bottom: 15px;
    color: #1e3a5f;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================
   КАРТОЧКИ ДОКУМЕНТОВ
   ============================================ */
.results-section h3 {
    margin-bottom: 15px;
    color: #374151;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.document-card {
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-left: 4px solid #2563eb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.document-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.document-header h4 {
    font-size: 18px;
}

.document-header h4 a {
    color: #1e3a5f;
}

.document-header h4 a:hover {
    color: #2563eb;
}

.document-category {
    background: #eff6ff;
    color: #2563eb;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.document-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tag {
    background: #f3f4f6;
    color: #6b7280;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
    transition: background 0.2s;
}

a.tag:hover {
    background: #e5e7eb;
    text-decoration: none;
}

.document-snippet {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.document-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-date {
    font-size: 13px;
    color: #999;
}

/* ============================================
   ПРОСМОТР ДОКУМЕНТА
   ============================================ */
.breadcrumbs {
    padding: 15px 0;
    font-size: 14px;
    color: #888;
}

.breadcrumbs a {
    color: #2563eb;
}

.document-full {
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.document-full-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
}

.document-full-header h2 {
    color: #1e3a5f;
    font-size: 24px;
    margin-bottom: 10px;
}

.document-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.document-download {
    margin-bottom: 25px;
}

.document-body {
    font-size: 15px;
    line-height: 1.8;
    color: #444;
    margin-bottom: 30px;
    white-space: pre-wrap;
}

.document-back {
    padding-top: 20px;
    border-top: 2px solid #f3f4f6;
}

/* ============================================
   НЕТ РЕЗУЛЬТАТОВ
   ============================================ */
.no-results {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.no-results p:first-child {
    font-size: 20px;
    margin-bottom: 8px;
}

/* ============================================
   АДМИНКА
   ============================================ */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-header h2 {
    color: #1e3a5f;
}

.admin-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-collapse: collapse;
}

.admin-table thead {
    background: #1e3a5f;
    color: white;
}

.admin-table th {
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.admin-table tbody tr:hover {
    background-color: #f9fafb;
}

.admin-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============================================
   ФОРМА ЗАГРУЗКИ
   ============================================ */
.upload-form {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-top: 20px;
}

/* ============================================
   ПАГИНАЦИЯ
   ============================================ */
.pagination {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* ============================================
   ПОДВАЛ
   ============================================ */
.site-footer {
    background: #1e3a5f;
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 15px 20px;
    font-size: 13px;
    margin-top: auto;
}

/* ============================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ============================================ */
@media (max-width: 768px) {
    .company-name {
        font-size: 20px;
    }

    .company-logo {
        height: 40px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-user {
        justify-content: center;
        flex-wrap: wrap;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .document-header {
        flex-direction: column;
    }

    .document-full {
        padding: 20px;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }

    .admin-actions {
        flex-direction: column;
    }

    .form-buttons {
        flex-direction: column;
    }
}