/* ===== СБРОС ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #1e293b;
    line-height: 1.5;
}

/* ===== КОНТЕЙНЕРЫ ===== */
/* Основной контейнер для всех страниц, кроме логина */
.container:not(.login-container) {
    max-width: 1400px;
    margin: 40px auto;
    padding: 32px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
    border: 1px solid #e9edf2;
}

/* Для страницы входа */
.login-container {
    max-width: 400px !important; /* принудительно 400px */
    margin: 80px auto;
    padding: 32px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
    border: 1px solid #e9edf2;
}

/* Если вдруг есть div без класса, но не логин */
body > div:not([class*="login"]):not([class*="container"]) {
    margin: 40px auto;
    padding: 32px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9edf2;
}
/* ===== ЗАГОЛОВКИ ===== */
h1 {
    font-size: 28px;
    font-weight: 500;
    color: #0f1829;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 20px;
    font-weight: 500;
    color: #1e2a44;
    margin-bottom: 20px;
    border-bottom: 1px solid #e9edf2;
    padding-bottom: 12px;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e6d;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ===== ТЕКСТ ===== */
p {
    color: #475569;
    margin-bottom: 16px;
}

/* ===== ШАПКА С КНОПКОЙ ВЫХОДА ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
}

/* ===== КНОПКА ВЫХОДА ===== */
.logout,
a[href*="logout"],
a[href*="logout.php"] {
    display: inline-block;
    padding: 8px 20px;
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    margin: 0; /* убираем все старые отступы */
    float: none; /* отключаем float */
}

.logout:hover,
a[href*="logout"]:hover,
a[href*="logout.php"]:hover {
    background: #f8fafc;
    color: #dc2626;
    border-color: #dc2626;
}

/* ===== КНОПКИ ===== */
button,
.btn,
input[type="submit"],
a.btn,
a.btn-primary,
a.btn-success,
a.btn-danger,
.btn-primary,
.btn-success,
.btn-danger {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: #2c3e6d;
    border-color: #d0d9e8;
}

button:hover,
.btn:hover,
input[type="submit"]:hover,
a.btn:hover {
    background: #f5f9ff;
    border-color: #2c3e6d;
}

/* Основная синяя кнопка */
.btn-primary,
input[type="submit"].btn-primary,
button.btn-primary,
a.btn-primary {
    background: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.btn-primary:hover,
input[type="submit"].btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover {
    background: #102a44;
    border-color: #102a44;
    color: white;
}

/* Зеленая кнопка (загрузка) */
.btn-success,
button.btn-success,
a.btn-success {
    background: #2b6e4f;
    color: white;
    border-color: #2b6e4f;
}

.btn-success:hover,
button.btn-success:hover,
a.btn-success:hover {
    background: #1e543c;
    border-color: #1e543c;
    color: white;
}

/* Красная кнопка (удаление) */
.btn-danger,
button.btn-danger,
a.btn-danger {
    background: white;
    color: #b91c1c;
    border-color: #fecaca;
}

.btn-danger:hover,
button.btn-danger:hover,
a.btn-danger:hover {
    background: #fee2e2;
    border-color: #b91c1c;
}

/* Маленькие кнопки */
.btn-sm,
button.btn-sm,
a.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* Кнопка "Назад" */
a[href*="login.php"]:not(.btn-primary),
a[href*="dashboard"]:not(.btn-primary) {
    display: inline-block;
    padding: 8px 0;
    color: #64748b;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    margin-bottom: 20px;
}

a[href*="login.php"]:not(.btn-primary):hover,
a[href*="dashboard"]:not(.btn-primary):hover {
    color: #1e3a5f;
    border-bottom-color: #1e3a5f;
}

/* ===== ФОРМЫ ===== */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d9e6;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    background: white;
    transition: all 0.2s;
    margin-bottom: 16px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.05);
}

input[type="file"] {
    padding: 8px;
    background: #f9fbfd;
}

/* ===== ТАБЛИЦЫ ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
    border: 1px solid #e9edf2;
    border-radius: 8px;
    overflow: hidden;
}

th {
    background: #f8fafd;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #d9e2ef;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9edf2;
    color: #334155;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f9fbfd;
}

/* ===== СООБЩЕНИЯ ===== */
.error,
.success,
.info,
.message-error,
.message-success,
.message-info {
    padding: 14px 18px;
    margin-bottom: 24px;
    border-left: 4px solid;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.error,
.message-error {
    border-color: #dc2626;
    background: #fef2f2;
    color: #991b1b;
}

.success,
.message-success {
    border-color: #2b6e4f;
    background: #f0fdf4;
    color: #166534;
}

.info,
.message-info {
    border-color: #1e3a5f;
    background: #f0f7ff;
    color: #1e3a5f;
}

/* ===== ОБЛАСТЬ ЗАГРУЗКИ ===== */
.upload-area,
.qr-code,
.qr-section {
    border: 1px dashed #a0b8d4;
    background: #f9fbfd;
    padding: 32px;
    text-align: center;
    border-radius: 8px;
    margin: 24px 0;
}

.upload-area:hover,
.qr-code:hover,
.qr-section:hover {
    background: #f4f9ff;
    border-color: #1e3a5f;
}

/* ===== ТРЕБОВАНИЯ ===== */
.requirements,
.secret-box,
.backup-codes {
    background: #f8fafd;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid #e2eaf2;
    font-size: 14px;
}

/* ===== БЕЙДЖИ / СТАТУСЫ ===== */
.badge,
.status,
.badge-consent,
.badge-exam,
.badge-other {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #eef2f6;
    color: #2c3e6d;
}

.badge-consent,
.status-consent {
    background: #e6f7e6;
    color: #1e543c;
}

.badge-exam,
.status-exam {
    background: #e6f0ff;
    color: #1e3a5f;
}

.badge-other,
.status-other {
    background: #eef2f6;
    color: #475569;
}

/* ===== РАЗДЕЛЫ ===== */
.section {
    margin: 32px 0;
    padding: 24px;
    background: #fafcfd;
    border: 1px solid #e9edf2;
    border-radius: 8px;
}

/* ===== QR-код ===== */
.qr-code img,
img[alt*="QR"] {
    max-width: 200px;
    border: 1px solid #e2eaf2;
    padding: 8px;
    background: white;
    margin: 16px auto;
    display: block;
}

/* ===== ССЫЛКИ ===== */
a {
    color: #1e3a5f;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #102a44;
}

/* ===== АДАПТАЦИЯ ===== */
@media (max-width: 768px) {
    body > div:not(.login-container) {
        margin: 20px;
        padding: 20px;
    }
    
    a[href*="logout"],
    a[href*="logout.php"] {
        float: none;
        display: inline-block;
        margin-bottom: 16px;
    }
}
