* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background: #f3f4f6;
    color: #111827;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.container {
    max-width: 900px;
    width: 100%;
    padding: 24px;
}

/* HEADER */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
}

/* КНОПКИ */

.btn-primary,
.btn-secondary {
    padding: 9px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.6);
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
    box-shadow: 0 2px 6px rgba(148, 163, 184, 0.4);
}

.btn-secondary:hover {
    background: #d1d5db;
    transform: translateY(-1px);
}

/* Кнопка удаления */

.btn-danger {
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: #dc2626;
    color: #ffffff;
    margin-left: 4px;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.55);
}

/* РОЛИ (страница пользователя) */

.role-section {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    margin-bottom: 16px;
}

.role-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.role-btn {
    flex: 1 1 30%;
    min-width: 150px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.role-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.role-btn:hover {
    transform: translateY(-1px);
}

.role-selected {
    font-size: 14px;
    color: #4b5563;
}

/* ФОРМА ЗАГРУЗКИ */

.upload-section {
    background: #ffffff;
    padding: 16px 20px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    margin-bottom: 16px;
}

.upload-section h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.upload-form .form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.form-group input[type="file"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.form-group input[type="file"],
.form-group input[type="password"],
.form-group input[type="text"] {
    background: #f9fafb;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* УВЕДОМЛЕНИЯ */

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.alert.success {
    background: #bbf7d0;
    color: #14532d;
    border: 1px solid #22c55e;
}

.alert.error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* МОДАЛКИ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}

.modal.open {
    display: flex;
}

.modal-content {
    max-width: 420px;
    width: 100%;
    background: #0f172a;
    color: #e5e7eb;
    padding: 20px 22px 18px;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.8);
    text-align: center;
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 600;
}

.modal-message-text {
    margin: 6px 0 16px;
    font-size: 14px;
    color: #e5e7eb;
}

.modal-content .form-group {
    margin-top: 8px;
}

.modal-content .form-group label {
    color: #e5e7eb;
}

.modal-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* АДМИНКА */

.logout-form {
    margin: 0;
}

.admin-ready-upload {
    margin-bottom: 16px;
}

.muted {
    color: #6b7280;
    font-size: 13px;
}

.admin-filters {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    margin-bottom: 16px;
}

.admin-filters h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

/* КНОПКИ ФИЛЬТРА В АДМИНКЕ */

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    flex: 1 1 0;
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    font-size: 14px;
    text-decoration: none;
    color: #111827;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.filter-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.filter-btn:hover {
    transform: translateY(-1px);
}

/* Таблица файлов */

.admin-table-section {
    background: #ffffff;
    padding: 16px 20px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.table-wrapper {
    overflow-x: auto;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.files-table th,
.files-table td {
    padding: 8px 8px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.files-table th {
    text-align: left;
    font-weight: 600;
    background: #f9fafb;
}

.files-table tr:nth-child(even) td {
    background: #f9fafb;
}

.actions-cell {
    white-space: nowrap;
}

/* Ссылка СКАЧАТЬ */

.download-link {
    font-size: 13px;
    text-decoration: none;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    transition: background 0.15s ease, transform 0.05s ease;
    color: #111827;
}

.download-link:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.inline-form {
    display: inline;
}

/* АДАПТИВ */

@media (max-width: 640px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .role-buttons {
        flex-direction: column;
    }

    .header h1 {
        font-size: 20px;
    }

    .modal-content {
        max-width: 100%;
    }

    .filter-buttons {
        flex-direction: column;
    }
}
