/* ═══════════════════════════════════════════════════════════════════════
   TimeTrack Web — главный файл стилей
   Цветовая палитра совпадает с PyQt6-версией:
     #4a6274  — шапка (тёмно-серо-синий)
     #3a5060  — кнопки шапки / наведение
     #eef2f7  — фон страницы
     #cad8e0  — кнопки навигации (светло-голубой)
     #2c4050  — текст кнопок навигации
     #c8e1cc  — кнопки «приход» / подтверждение (зелёный)
     #2d5a35  — текст зелёных кнопок
     #c95b5b  — кнопки «уход» / удаление (красный)
     white    — фон карточек
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Сброс и базовые настройки ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    background-color: #eef2f7;
    color: #333;
    min-height: 100vh;
}

/* ── Логин ──────────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #3a5060 0%, #4a6274 50%, #5a7284 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-title {
    font-size: 22px;
    font-weight: bold;
    color: #2c4050;
    margin-bottom: 6px;
}

.login-subtitle { font-size: 14px; color: #6c757d; }

.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus { border-color: #4a6274; }

.login-error {
    background: #fde8e8;
    color: #c95b5b;
    border: 1px solid #c95b5b;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background-color: #4a6274;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-login:hover { background-color: #3a5060; }
.btn-login:disabled { background-color: #aec0cc; cursor: not-allowed; }

/* ── Шапка (top-bar) ────────────────────────────────────────────────────── */
.top-bar {
    background-color: #4a6274;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left, .top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-center {
    flex: 1;
    text-align: center;
}

.btn-topbar {
    background-color: #3a5060;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 20px;
    height: 36px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-topbar:hover { background-color: #506878; }

.user-info {
    color: white;
    font-size: 14px;
    font-weight: bold;
    padding: 0 15px;
}

.clock {
    color: white;
    font-size: 14px;
    font-family: monospace;
    padding: 0 15px;
    background-color: #3a5060;
    border-radius: 6px;
    height: 36px;
    display: flex;
    align-items: center;
}

.btn-logout {
    background-color: #c95b5b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 20px;
    height: 36px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout:hover { background-color: #b04848; }

/* ── Навигационная полоса ────────────────────────────────────────────────── */
.nav-bar {
    background-color: #eef2f7;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    position: relative;
}

.btn-nav {
    background-color: #cad8e0;
    color: #2c4050;
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-nav:hover { background-color: #aec0cc; }
.btn-nav.active { background-color: #4a6274; color: white; }

.notif-badge {
    color: #2980b9;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    margin-top: -8px;
    margin-left: -2px;
}

/* ── Основной контент ───────────────────────────────────────────────────── */
.main-content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-title {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 24px;
}

/* ── Главная страница — карточка отметки ────────────────────────────────── */
.page-dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding-top: 20px;
}

.attendance-card {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 30px 40px;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.attendance-title {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 18px;
}

.last-attendance {
    font-size: 16px;
    color: #495057;
    padding: 14px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 22px;
}

.attendance-buttons {
    display: flex;
    gap: 20px;
}

.btn-checkin, .btn-checkout {
    flex: 1;
    padding: 18px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-checkin {
    background-color: #c8e1cc;
    color: #2d5a35;
}
.btn-checkin:hover:not(:disabled) { background-color: #a8cdb0; }

.btn-checkout {
    background-color: #c95b5b;
    color: white;
}
.btn-checkout:hover:not(:disabled) { background-color: #b04848; }

.btn-checkin:disabled, .btn-checkout:disabled {
    background-color: #d6d6d6;
    color: #888;
    cursor: not-allowed;
}

.nav-buttons-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-nav-card {
    background-color: #cad8e0;
    color: #2c4050;
    border-radius: 6px;
    padding: 12px 26px;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s;
    min-width: 130px;
    text-align: center;
}

.btn-nav-card:hover { background-color: #aec0cc; }

/* ── Общие кнопки ───────────────────────────────────────────────────────── */
.btn-primary {
    background-color: #4a6274;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary:hover { background-color: #3a5060; }

.btn-success {
    background-color: #c8e1cc;
    color: #2d5a35;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-success:hover { background-color: #a8cdb0; }

.btn-danger {
    background-color: #c95b5b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-danger:hover { background-color: #b04848; }

.btn-secondary {
    background-color: #cad8e0;
    color: #2c4050;
    border: none;
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-secondary:hover { background-color: #aec0cc; }

/* ── Таблицы ────────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    font-size: 14px;
}

.data-table th {
    background-color: #f8f9fa;
    padding: 12px 14px;
    font-weight: bold;
    border: 1px solid #dee2e6;
    text-align: left;
    color: #495057;
}

.data-table td {
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.data-table tr:hover td { background-color: #f5f8fa; }

/* Цвета уведомлений */
.notif-critical  td { background-color: #fde8e8; }
.notif-warning   td { background-color: #fdf6e3; }
.notif-important td { background-color: #e8f1ff; }
.notif-info      td { background-color: #e8f5ea; }

/* ── Модальные окна ─────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 900;
}

.modal-overlay.active { display: block; }

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 100%;
    max-width: 560px;
    padding: 0 16px;
}

.modal.active { display: block; }

.modal-dialog {
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    overflow: hidden;
}

.modal-sm  { max-width: 340px; margin: 0 auto; }
.modal-md  { max-width: 560px; margin: 0 auto; }
.modal-lg  { max-width: 800px; margin: 0 auto; }
.modal-xl  { max-width: 1050px; margin: 0 auto; }

.modal-header {
    padding: 16px 20px;
    background-color: #4a6274;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-success { background-color: #c8e1cc; }
.modal-header-warning { background-color: #f5deb3; }
.modal-header-error   { background-color: #fde8e8; }

.modal-title {
    font-size: 16px;
    font-weight: bold;
    color: white;
    margin: 0;
}

.modal-header-success .modal-title,
.modal-header-warning .modal-title { color: #2c4050; }
.modal-header-error .modal-title   { color: #c95b5b; }

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 14px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #dee2e6;
}

/* ── Пин-код ────────────────────────────────────────────────────────────── */
.pin-label {
    font-size: 14px;
    font-weight: bold;
    color: #495057;
    margin-bottom: 10px;
}

.pin-input {
    width: 100%;
    padding: 12px;
    font-size: 22px;
    letter-spacing: 8px;
    text-align: center;
    border: 2px solid #3498db;
    border-radius: 8px;
    font-family: monospace;
    outline: none;
}

.pin-input:focus { border-color: #2980b9; }

.pin-error {
    color: #c95b5b;
    font-size: 13px;
    margin-top: 8px;
}

.btn-confirm {
    background-color: #c8e1cc;
    color: #2d5a35;
    border: none;
    border-radius: 6px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-confirm:hover { background-color: #a8cdb0; }
.btn-confirm:disabled { background-color: #aaa; cursor: not-allowed; }

.btn-cancel {
    background-color: #c95b5b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-cancel:hover { background-color: #b04848; }

/* ── Формы ──────────────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-col  { flex: 1; min-width: 200px; }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Карточки / панели ──────────────────────────────────────────────────── */
.card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

/* ── Алерты (flash-сообщения) ───────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e8f5ea; color: #2d5a35; border: 1px solid #c8e1cc; }
.alert-error   { background: #fde8e8; color: #c95b5b; border: 1px solid #c95b5b; }
.alert-warning { background: #fdf6e3; color: #856404; border: 1px solid #ffc107; }
.alert-info    { background: #e8f1ff; color: #2980b9; border: 1px solid #2980b9; }

/* ── Поисковая строка + фильтры ─────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.search-input {
    padding: 8px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    min-width: 260px;
    outline: none;
}
.search-input:focus { border-color: #4a6274; }

/* ── Статус-бейджи ──────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.badge-active   { background: #c8e1cc; color: #2d5a35; }
.badge-inactive { background: #f0f0f0; color: #666; }
.badge-paid     { background: #c8e1cc; color: #2d5a35; }
.badge-unpaid   { background: #fde8e8; color: #c95b5b; }
.badge-pending  { background: #fdf6e3; color: #856404; }

/* ── Вкладки (tabs) ─────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
    gap: 2px;
}

.tab-btn {
    padding: 10px 22px;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background-color: #f8f9fa;
    color: #495057;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s;
    flex: 1;
    text-align: center;
}

.tab-btn:hover { background-color: #e9ecef; }

.tab-btn.active {
    background-color: #cad8e0;
    color: #2c4050;
    border-bottom: 2px solid #cad8e0;
    margin-bottom: -2px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Спиннер загрузки ───────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #dee2e6;
    border-top-color: #4a6274;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* ── Адаптивность ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-content { padding: 16px; }
    .attendance-card { padding: 20px; }
    .attendance-buttons { flex-direction: column; }
    .nav-buttons-row { flex-direction: column; align-items: center; }
    .form-row { flex-direction: column; }
    .top-bar { height: auto; flex-wrap: wrap; padding: 10px; gap: 8px; }
    .modal { max-width: 98vw; }
}

/* ── Скроллбар (Webkit) ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #aec0cc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a6274; }
