/* ============================================================
   ОСНОВНЫЕ СТИЛИ
   ============================================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 20px;
    background: #f0f4f8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

input, button {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: all 0.2s;
}

button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

    button:hover {
        opacity: 0.9;
        transform: translateY(-1px);
    }

    button:active {
        transform: translateY(0);
    }

.reassign-btn {
    width: auto;
    padding: 6px 12px;
    margin: 0;
    background: #17a2b8;
    color: white;
}

    .reassign-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.error {
    color: #dc3545;
}

.success {
    color: #28a745;
}

.question {
    margin: 20px 0;
}

.correct-answer {
    background-color: #28a745 !important;
    color: white;
}

.wrong-answer {
    background-color: #dc3545 !important;
    color: white;
}

.neutral-answer {
    background-color: #6c757d !important;
    color: white;
}

.option {
    margin: 10px 0;
}

.progress {
    background: #e0e0e0;
    border-radius: 5px;
    padding: 5px;
    margin-bottom: 10px;
}

#main-menu button {
    display: block;
    width: 80%;
    margin: 10px auto;
}

/* ============================================================
   ФИЛЬТРЫ
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    flex-wrap: wrap;
}

    .filter-bar label {
        font-weight: bold;
    }

    .filter-bar select {
        padding: 6px 10px;
        font-size: 14px;
        border-radius: 5px;
        border: 1px solid #ccc;
    }

    .filter-bar button {
        width: auto;
        padding: 6px 12px;
        margin: 0;
        background: #28a745;
    }

/* ============================================================
   АДМИН-ПАНЕЛЬ
   ============================================================ */
#admin-panel {
    margin-top: 20px;
}

.driver-card {
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

    .driver-card.red {
        background-color: #ffe6e6;
        border-left: 5px solid #dc3545;
    }

    .driver-card.green {
        background-color: #e6ffe6;
        border-left: 5px solid #28a745;
    }

    .driver-card.gray {
        background-color: #e0e0e0;
        border-left: 5px solid #6c757d;
        opacity: 0.7;
    }

.driver-info {
    flex: 1;
}

.driver-status {
    font-weight: bold;
    margin-top: 5px;
    font-size: 14px;
}

.reset-btn {
    width: auto;
    padding: 6px 12px;
    margin: 0;
    background: #ffc107;
    color: black;
}

    .reset-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.driver-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.force-pass-btn {
    background-color: #28a745;
    color: white;
}

.icon-class {
    background: #fff3e0;
}

/* ============================================================
   ПРОГРЕСС ЭКЗАМЕНА
   ============================================================ */
.progress-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 10px;
}

.progress-square {
    width: 35px;
    height: 35px;
    background-color: #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #ccc;
}

    .progress-square.correct {
        background-color: #28a745;
    }

    .progress-square.wrong {
        background-color: #dc3545;
    }

    .progress-square.current {
        border: 3px solid #007bff;
        transform: scale(1.1);
    }

/* ============================================================
   ПРОФИЛЬ
   ============================================================ */
.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 420px;
    margin: 0 auto;
}

/* Аватар */
.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 4px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

    .avatar-wrapper:hover {
        transform: scale(1.03);
    }

    .avatar-wrapper img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
        background: #e0e0e0;
        border: 3px solid white;
    }

    .avatar-wrapper .camera-icon {
        position: absolute;
        bottom: 4px;
        right: 4px;
        background: #007bff;
        color: white;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        border: 2px solid white;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    }

    .avatar-wrapper input[type="file"] {
        display: none;
    }

/* Кнопки управления фото */
.photo-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

    .photo-actions button {
        width: auto !important;
        padding: 6px 16px !important;
        font-size: 13px !important;
        border-radius: 20px !important;
        border: none !important;
        cursor: pointer;
        transition: all 0.2s;
        margin: 0 !important;
    }

.btn-delete-photo {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

    .btn-delete-photo:hover {
        background: #fecaca !important;
    }

#upload-progress {
    display: none;
    margin-top: 6px;
    font-size: 13px;
    color: #007bff;
}

/* Имя и табельный */
.profile-name {
    text-align: center;
    margin-top: 12px;
}

    .profile-name h2 {
        font-size: 22px;
        font-weight: 700;
        color: #1a1a2e;
        margin: 0;
    }

    .profile-name .tab-number {
        font-size: 14px;
        color: #6b7280;
        margin-top: 2px;
    }

/* Карточки статусов */
.status-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    width: 100%;
}

.status-card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

    .status-card:hover {
        border-color: #94a3b8;
        background: #f1f5f9;
    }

    .status-card .left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .status-card .icon {
        font-size: 22px;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

.icon-exam {
    background: #dbeafe;
}

.icon-medical {
    background: #fce7f3;
}

.icon-routes {
    background: #d1fae5;
}

.icon-vehicle {
    background: #fef3c7;
}

.status-card .label {
    font-size: 13px;
    color: #6b7280;
}

.status-card .value {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.status-card .date-text {
    font-size: 13px;
    color: #6b7280;
}

/* Бейджи */
.badge {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Теги (маршруты и ПС) */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: #e2e8f0;
    color: #1e293b;
}

.tag-route {
    background: #dbeafe;
    color: #1e40af;
}

.tag-vehicle {
    background: #fef3c7;
    color: #92400e;
}

.tag-empty {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 400;
}

/* Статистика */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
    width: 100%;
}

    .profile-stats .stat-card {
        background: #f8fafc;
        border-radius: 14px;
        padding: 14px 8px;
        text-align: center;
        border: 1px solid #e2e8f0;
        transition: all 0.2s;
    }

        .profile-stats .stat-card:hover {
            border-color: #94a3b8;
            background: #f1f5f9;
        }

        .profile-stats .stat-card .number {
            font-size: 26px;
            font-weight: 700;
            color: #1a2a6c;
        }

        .profile-stats .stat-card .label {
            font-size: 11px;
            color: #6b7280;
            margin-top: 2px;
        }

        .profile-stats .stat-card .sub {
            font-size: 10px;
            color: #94a3b8;
            margin-top: 2px;
        }

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-card,
.profile-stats .stat-card {
    animation: fadeInUp 0.4s ease forwards;
}

    .status-card:nth-child(1) {
        animation-delay: 0.05s;
    }

    .status-card:nth-child(2) {
        animation-delay: 0.10s;
    }

    .status-card:nth-child(3) {
        animation-delay: 0.15s;
    }

    .status-card:nth-child(4) {
        animation-delay: 0.20s;
    }

    .profile-stats .stat-card:nth-child(1) {
        animation-delay: 0.10s;
    }

    .profile-stats .stat-card:nth-child(2) {
        animation-delay: 0.15s;
    }

    .profile-stats .stat-card:nth-child(3) {
        animation-delay: 0.20s;
    }

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 420px) {
    .container {
        padding: 16px;
        border-radius: 16px;
    }

    .avatar-wrapper {
        width: 100px;
        height: 100px;
    }

    .profile-name h2 {
        font-size: 19px;
    }

    .profile-stats {
        gap: 6px;
    }

        .profile-stats .stat-card .number {
            font-size: 20px;
        }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

        .filter-bar button {
            width: 100%;
        }

    .driver-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .driver-actions {
        justify-content: stretch;
    }

        .driver-actions button {
            flex: 1;
        }
}

@media (max-width: 600px) {
    .profile-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .status-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

        .status-card .date-text {
            align-self: flex-start;
        }
}

/* ============================================================
   СТРАНИЦА ЛОГИНА
   ============================================================ */

/* Контейнер формы логина */
#login-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 10px 0;
}

/* Поля ввода логина и пароля */
#login-form input {
    width: 100%;
    max-width: 380px;
    padding: 12px 16px;
    margin: 8px auto;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    transition: all 0.2s;
    display: block;
    box-sizing: border-box;
}

#login-form input:focus {
    border-color: #007bff;
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* Кнопка входа */
#login-form button {
    width: 100%;
    max-width: 380px;
    padding: 14px;
    margin: 12px auto;
    font-size: 17px;
    font-weight: 600;
    border-radius: 10px;
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    display: block;
    transition: all 0.2s;
}

#login-form button:hover {
    background: #0069d9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Ошибка */
#login-error {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
}

/* Заголовок страницы логина */
#app h2 {
    text-align: center;
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 20px;
}

/* Для мобильных устройств */
@media (max-width: 480px) {
    #login-form input,
    #login-form button {
        max-width: 100%;
        padding: 14px 16px;
        font-size: 16px;
    }
    
    #app h2 {
        font-size: 20px;
    }
}

/* ============================================================
   ПРОФИЛЬ ПАРКА — АДАПТИВ
   ============================================================ */

/* Статистика — на телефоне в 2 колонки */
@media (max-width: 700px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 450px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .stats-grid div {
        padding: 10px !important;
    }
    .stats-grid h2 {
        font-size: 20px !important;
        margin: 5px 0 !important;
    }
    .stats-grid p {
        font-size: 12px !important;
    }
}

/* Фильтры на телефоне */
@media (max-width: 600px) {
    .filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    .filter-bar input,
    .filter-bar select,
    .filter-bar button {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .filter-bar label {
        margin-top: 5px !important;
    }
}

/* Таблица на телефоне */
@media (max-width: 700px) {
    #drivers-table {
        font-size: 12px !important;
    }
    #drivers-table th,
    #drivers-table td {
        padding: 6px 4px !important;
        white-space: nowrap !important;
    }
    /* Прячем лишние колонки */
    #drivers-table th:nth-child(3),
    #drivers-table td:nth-child(3),
    #drivers-table th:nth-child(4),
    #drivers-table td:nth-child(4) {
        display: none !important;
    }
    #drivers-table button {
        padding: 2px 6px !important;
        font-size: 11px !important;
        margin: 0 !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 400px) {
    #drivers-table th:nth-child(5),
    #drivers-table td:nth-child(5) {
        display: none !important;
    }
    .driver-actions button {
        font-size: 10px !important;
        padding: 2px 4px !important;
    }
}
