/* 
 * Версия: 1.0
 */

/* ---------- RESET ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: #f2f5f9;
    color: #1a2c3e;
}

/* ---------- TOP BAR (шапка) ---------- */
.top-bar {
    background: #003366;
    color: white;
    padding: 0 30px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area img {
    height: 45px;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-name {
    font-weight: 400;
    font-size: 14px;
}

.logout-btn {
    background: #ff8c00;
    color: white;
    padding: 8px 18px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: #e07a00;
    transform: translateY(-1px);
}

/* ---------- КОНТЕЙНЕР И КАРТОЧКИ ---------- */
.container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 25px;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 25px 30px;
    margin-bottom: 30px;
    border: 1px solid #e6edf4;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 20px;
    color: #003366;
    border-left: 4px solid #ff8c00;
    padding-left: 15px;
}

/* ---------- ФОРМЫ ---------- */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    min-width: 220px;
}

label {
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
}

input, textarea, select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccd7e6;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: #fefefe;
}

textarea {
    font-family: monospace;
    resize: vertical;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0,51,102,0.1);
}

/* ---------- КНОПКИ ---------- */
button {
    background: #003366;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: #002244;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: transparent;
    border: 1px solid #003366;
    color: #003366;
}

.btn-outline:hover {
    background: #eef3fc;
    transform: translateY(-1px);
}

/* ---------- СТАТУС И ПРОГРЕСС ---------- */
.status-card {
    background: #f8fafc;
    border-left: 5px solid #ff8c00;
}

.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.stat {
    background: white;
    padding: 8px 18px;
    border-radius: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-size: 14px;
}

.stat i {
    color: #003366;
    margin-right: 6px;
}

.progress-bar {
    background: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    background: #ff8c00;
    height: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ---------- ТАБЛИЦЫ ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f5;
}

th {
    background: #f5f7fa;
    font-weight: 600;
    color: #003366;
}

tr:hover {
    background: #f8fafc;
}

.matched-words {
    color: #0f7b3a;
    font-weight: 500;
}

.context-preview {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- ОРГАНИЗАЦИИ (список) ---------- */
.org-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    max-height: 150px;
    overflow-y: auto;
    padding: 5px 0;
}

.org-item {
    background: #eef3fc;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 13px;
    color: #003366;
}

/* ---------- МОДАЛЬНЫЕ ОКНА ---------- */
.modal {
    display: none;
    position: fixed;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
}

.modal-content {
    background: white;
    max-width: 550px;
    width: 90%;
    border-radius: 16px;
    padding: 25px;
    position: relative;
    box-shadow: 0 20px 35px rgba(0,0,0,0.2);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

.close:hover {
    color: #003366;
}

/* ---------- КОНТЕКСТ (AI анализ) ---------- */
.context-text {
    background: #f1f5f9;
    padding: 12px;
    border-radius: 12px;
    margin: 12px 0;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

mark {
    background: #ffeb3b;
    padding: 0 2px;
    border-radius: 4px;
    color: #1a2c3e;
}

/* ---------- КНОПКА AI ---------- */
.ai-check {
    background: #8b5cf6;
    font-size: 12px;
    padding: 6px 12px;
}

.ai-check:hover {
    background: #7c3aed;
}

/* ---------- АДАПТИВНОСТЬ ---------- */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
        margin: 15px auto;
    }
    .card {
        padding: 20px;
    }
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    .top-bar {
        padding: 0 15px;
        height: 60px;
    }
    .logo-text {
        font-size: 16px;
    }
    .logo-area img {
        height: 35px;
    }
    .user-name {
        font-size: 12px;
    }
    .logout-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
    th, td {
        font-size: 12px;
        padding: 8px 6px;
    }
    .context-preview {
        max-width: 150px;
    }
    button {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ---------- УТИЛИТЫ ---------- */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}