﻿/* ========== ОСНОВНЫЕ ПЕРЕМЕННЫЕ ========== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --border: #e2e8f0;
    --header-height: 64px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* ========== СБРОС И БАЗОВЫЕ СТИЛИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f1f5f9;
    color: var(--dark);
    line-height: 1.5;
}

/* ========== ШАПКА ========== */
.app-header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    font-size: 18px;
}

    .logo i {
        color: var(--primary);
        font-size: 24px;
    }

    .logo span {
        letter-spacing: 0.5px;
    }

/* Навигация */
.main-nav {
    flex: 1;
    margin: 0 32px;
}

.nav-menu {
    display: flex;
    gap: 8px;
    list-style: none;
}

    .nav-menu a {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 16px;
        color: var(--secondary);
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        border-radius: 6px;
        transition: all 0.2s;
    }

        .nav-menu a i {
            font-size: 16px;
        }

        .nav-menu a:hover {
            background: var(--light);
            color: var(--primary);
        }

        .nav-menu a.active {
            background: var(--primary);
            color: white;
        }

            .nav-menu a.active i {
                color: white;
            }

/* Пользовательское меню */
.user-menu {
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--light);
    padding: 4px 12px 4px 8px;
    border-radius: 40px;
    border: 1px solid var(--border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 18px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

    .logout-btn:hover {
        color: var(--danger);
        background: rgba(239, 68, 68, 0.1);
    }

.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

    .login-btn:hover {
        background: var(--primary-dark);
        color: white;
    }

/* ========== ОСНОВНОЙ КОНТЕНТ ========== */
.main-content {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 24px;
}

/* ========== ЗАГОЛОВКИ СТРАНИЦ ========== */
.page-title {
    font-size: 24px;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 24px;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .page-title i {
        color: var(--secondary);
    }

/* ========== КАРТОЧКИ ========== */
.card, .compact-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

    .card:hover, .compact-card:hover {
        box-shadow: var(--shadow-md);
    }

    .card-header, .compact-card .card-header {
        padding: 16px 20px;
        background: white;
        border-bottom: 1px solid var(--border);
        font-weight: 600;
        color: var(--dark);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        .card-header h3, .compact-card .card-header h3 {
            font-size: 15px;
            font-weight: 600;
            color: var(--dark);
            margin: 0;
            display: flex;
            align-items: center;
            gap: 8px;
        }

    .card-body, .compact-card .card-body {
        padding: 20px;
    }

    .compact-card .card-body {
        padding: 0;
    }

/* ========== СТАТИСТИКА ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

    .stat-card:hover {
        border-color: var(--gray);
        box-shadow: var(--shadow);
    }

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 500;
    color: var(--dark);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-trend {
    font-size: 12px;
    color: var(--secondary);
}

    .stat-trend.positive {
        color: var(--success);
    }

    .stat-trend.negative {
        color: var(--danger);
    }

/* ========== ТАБЛИЦЫ ========== */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.table, .dashboard-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    font-size: 14px;
}

    .table th, .dashboard-table th {
        background: var(--light);
        padding: 12px 16px;
        text-align: left;
        font-weight: 600;
        font-size: 13px;
        color: var(--secondary);
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
    }

    .table td, .dashboard-table td {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        font-size: 14px;
    }

    .table tr:last-child td, .dashboard-table tr:last-child td {
        border-bottom: none;
    }

    .table tbody tr:hover, .dashboard-table tbody tr:hover {
        background: var(--light);
    }

    .dashboard-table th {
        padding: 14px 20px;
    }

    .dashboard-table td {
        padding: 14px 20px;
    }

/* Информация о клиенте в таблицах */
.client-info {
    display: flex;
    flex-direction: column;
}

.client-name {
    font-weight: 500;
    color: var(--dark);
}

.client-car {
    font-size: 12px;
    color: var(--secondary);
}

/* Цены */
.price, .currency {
    font-weight: 600;
    color: var(--dark);
}

.time {
    color: var(--secondary);
    font-size: 12px;
}

/* ========== КНОПКИ ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 13px;
    gap: 4px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-dark);
        color: white;
    }

.btn-warning {
    background: var(--warning);
    color: white;
}

    .btn-warning:hover {
        background: #e07b0b;
        color: white;
    }

.btn-danger {
    background: var(--danger);
    color: white;
}

    .btn-danger:hover {
        background: #dc2626;
        color: white;
    }

.btn-info {
    background: var(--secondary);
    color: white;
}

    .btn-info:hover {
        background: #475569;
        color: white;
    }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--secondary);
}

    .btn-outline:hover {
        background: var(--light);
        border-color: var(--gray);
        color: var(--dark);
    }

.btn-success {
    background: var(--success);
    color: white;
}

    .btn-success:hover {
        background: #059669;
        color: white;
    }

.btn-group {
    display: inline-flex;
    gap: 4px;
}

/* ========== БЕЙДЖИ (СТАТУСЫ) ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--light);
    color: var(--secondary);
}

.badge-primary {
    background: #dbeafe;
    color: var(--primary);
}

.badge-success {
    background: #d1fae5;
    color: var(--success);
}

.badge-warning {
    background: #fed7aa;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

/* Статусные бейджи в таблицах */
.dashboard-table .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

    .dashboard-table .status-badge.new {
        background: #e0f2fe;
        color: #0369a1;
    }

    .dashboard-table .status-badge.working {
        background: #fed7aa;
        color: #92400e;
    }

    .dashboard-table .status-badge.ready {
        background: #d1fae5;
        color: #065f46;
    }

    .dashboard-table .status-badge.waiting {
        background: #e0e7ff;
        color: #3730a3;
    }

/* Маленькие точки для статусов */
.status-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

    .status-badge-dot.primary {
        background: var(--primary);
    }

    .status-badge-dot.warning {
        background: var(--warning);
    }

    .status-badge-dot.info {
        background: #0ea5e9;
    }

    .status-badge-dot.success {
        background: var(--success);
    }

    .status-badge-dot.secondary {
        background: var(--secondary);
    }

/* Список статусов */
.status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 16px 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-info {
    display: flex;
    flex-direction: column;
}

.status-name {
    font-size: 13px;
    color: var(--secondary);
}

.status-count {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

/* ========== ФОРМЫ ========== */
.form-group {
    margin-bottom: 16px;
}

    .form-group label {
        display: block;
        margin-bottom: 6px;
        font-size: 13px;
        font-weight: 500;
        color: var(--dark);
    }

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

    .form-control:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .form-control.is-invalid {
        border-color: var(--danger);
    }

.input-group {
    display: flex;
    align-items: center;
}

    .input-group .form-control {
        flex: 1;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

.input-group-text {
    padding: 8px 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--secondary);
    font-size: 14px;
}

.text-danger {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Поле с телефоном */
.phone-mask {
    font-family: monospace;
    letter-spacing: 1px;
}

/* ========== ПОИСК ========== */
.search-box {
    position: relative;
    max-width: 300px;
}

    .search-box i {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--gray);
        font-size: 14px;
        z-index: 1;
    }

    .search-box input {
        width: 100%;
        padding: 8px 12px 8px 36px;
        border: 1px solid var(--border);
        border-radius: 40px;
        font-size: 14px;
    }

/* ========== ПАГИНАЦИЯ ========== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.page-item.active .page-link {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-item .page-link:hover {
    background: var(--light);
    color: var(--dark);
}

/* ========== АЛЕРТЫ (УВЕДОМЛЕНИЯ) ========== */
.alert {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    animation: slideInDown 0.3s ease;
    border: none;
}

    .alert i {
        font-size: 20px;
    }

.alert-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.alert .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    cursor: pointer;
    background: transparent;
    border: none;
    font-size: 16px;
    margin-left: auto;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========== МЕХАНИКИ ========== */
.mechanic-list {
    padding: 8px;
}

.mechanic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

    .mechanic-row:last-child {
        border-bottom: none;
    }

.mechanic-name {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--dark);
}

    .mechanic-name i {
        color: var(--secondary);
        width: 16px;
    }

.mechanic-task {
    font-size: 13px;
    color: var(--secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mechanic-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--light);
    color: var(--secondary);
}

    .mechanic-status.busy {
        background: #fff3cd;
        color: #856404;
    }

/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    background: var(--light);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
}

/* ========== ЗАГРУЗКА ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== ПОДСКАЗКИ ========== */
.tooltip-icon {
    color: var(--secondary);
    cursor: help;
    margin-left: 4px;
    font-size: 14px;
}

    .tooltip-icon:hover {
        color: var(--primary);
    }

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 12px;
    }

    .logo span {
        display: none;
    }

    .main-nav {
        margin: 0 8px;
    }

    .nav-menu a span {
        display: none;
    }

    .nav-menu a i {
        font-size: 18px;
    }

    .user-name {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .btn span {
        display: none;
    }

    .btn i {
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .status-list {
        flex-direction: column;
        gap: 12px;
    }

    .mechanic-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .mechanic-task {
        max-width: 100%;
    }

    .table-responsive {
        overflow-x: auto;
    }

    .dashboard-table {
        min-width: 800px;
    }
}

/* ========== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ========== */
.text-muted {
    color: var(--secondary);
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

.fw-bold {
    font-weight: 600;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 20px;
}

.me-1 {
    margin-right: 4px;
}

.me-2 {
    margin-right: 8px;
}

.ms-1 {
    margin-left: 4px;
}

.ms-2 {
    margin-left: 8px;
}

.p-0 {
    padding: 0;
}

.p-3 {
    padding: 12px;
}

.p-4 {
    padding: 20px;
}

.py-3 {
    padding-top: 12px;
    padding-bottom: 12px;
}

.py-4 {
    padding-top: 20px;
    padding-bottom: 20px;
}

.py-5 {
    padding-top: 30px;
    padding-bottom: 30px;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-grow-1 {
    flex-grow: 1;
}

.w-100 {
    width: 100%;
}
