/* ========== ОБЩИЕ СТИЛИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #1c1c1e;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========== НАВИГАЦИЯ ========== */
.navbar {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    padding: 12px 0;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: #005bff;
    text-decoration: none;
}

/* ========== КАРТОЧКИ ========== */
.card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: none;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e9edef;
    padding: 20px 24px;
    font-weight: 600;
    font-size: 18px;
    color: #1c1c1e;
}

/* ========== КНОПКИ ========== */
.btn {
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;

}

.btn-primary {
    background: #005bff;
    color: white;
}

.btn-primary:hover {
    background: #0047cc;
    transform: none;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid #005bff;
    color: #005bff;
}

.btn-outline-primary:hover {
    background: #005bff;
    color: white;
}

.btn-success {
    background: #34c759;
    color: white;
}

.btn-outline-success {
    border: 1px solid #34c759;
    color: #34c759;
    background: transparent;
}

.btn-outline-success:hover {
    background: #34c759;
    color: white;
}

.btn-warning {
    background: #ff9500;
    color: white;
}

.btn-outline-warning {
    border: 1px solid #ff9500;
    color: #ff9500;
    background: transparent;
}

.btn-outline-warning:hover {
    background: #ff9500;
    color: white;
}

.btn-outline-info {
    border: 1px solid #5856d6;
    color: #5856d6;
    background: transparent;
}

.btn-outline-info:hover {
    background: #5856d6;
    color: white;
}

/* ========== ТАБЛИЦЫ ========== */
.table-container {
    background: white;
    border-radius: 20px;
    overflow-x: auto;
    border: 1px solid #e9edef;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: #f8f9fa;
    color: #6c6c70;
    font-weight: 600;
    font-size: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid #e9edef;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9edef;
    color: #1c1c1e;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* ========== СТАТУСЫ ========== */
.badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #e5f5e8;
    color: #2c6e2f;
}

.badge-warning {
    background: #fff0e0;
    color: #c45c00;
}

.badge-secondary {
    background: #e9edef;
    color: #5a5a5e;
}

.badge-info {
    background: #e3e2f9;
    color: #3a3897;
}

/* ========== ФОРМЫ ========== */
.form-control, .form-select, textarea {
    border-radius: 12px;
    border: 1px solid #e9edef;
    padding: 12px 16px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus, textarea:focus {
    border-color: #005bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,91,255,0.1);
}

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #1c1c1e;
}

/* ========== СТАТИСТИКА (карточки с числами) ========== */
.stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 20px;
}

.stat-card h5 {
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 0;
}

.bg-primary-gradient {
    background: linear-gradient(135deg, #005bff, #0047cc);
    color: white;
}

.bg-success-gradient {
    background: linear-gradient(135deg, #34c759, #28a745);
    color: white;
}

.bg-info-gradient {
    background: linear-gradient(135deg, #5856d6, #3a3897);
    color: white;
}

/* ========== АЛЕРТЫ ========== */
.alert {
    border-radius: 16px;
    border: none;
    padding: 14px 18px;
}

.alert-success {
    background: #e5f5e8;
    color: #2c6e2f;
}

.alert-danger {
    background: #ffe5e5;
    color: #bc2c2c;
}

/* ========== ФУТЕР ========== */
footer {
    text-align: center;
    padding: 24px;
    color: #8e8e93;
    font-size: 13px;
    margin-top: 40px;
    border-top: 1px solid #e9edef;
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ ========== */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    .stat-card h3 {
        font-size: 24px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .card-header {
        padding: 16px;
    }
}

/* ========== УПРАВЛЕНИЕ КЛИЕНТАМИ ========== */
.client-card {
    background: white;
    border-radius: 20px;
    border: 1px solid #e9edef;
    transition: all 0.2s;
}

.client-card:hover {
    border-color: #005bff;
}

/* ========== УПРАВЛЕНИЕ КУРЬЕРАМИ ========== */
.courier-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-free {
    background: #e5f5e8;
    color: #2c6e2f;
}

.status-busy {
    background: #fff0e0;
    color: #c45c00;
}

.status-off {
    background: #ffe5e5;
    color: #bc2c2c;
}

.courier-transport {
    background: #e9edef;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
}

/* ========== УПРАВЛЕНИЕ СОТРУДНИКАМИ ========== */
.role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-admin {
    background: #e5f5e8;
    color: #2c6e2f;
}

.role-dispatcher {
    background: #e3e2f9;
    color: #3a3897;
}

.role-courier {
    background: #fff0e0;
    color: #c45c00;
}

/* ========== КНОПКИ ДЕЙСТВИЙ ========== */
.action-buttons a {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border-radius: 10px;
    font-size: 13px;
    text-decoration: none;
}

.btn-edit {
    background: #e9edef;
    color: #1c1c1e;
}

.btn-delete {
    background: #ffe5e5;
    color: #bc2c2c;
}

.btn-reset {
    background: #fff0e0;
    color: #c45c00;
}

/* ========== ПОИСК И ФИЛЬТРЫ ========== */
.search-box input {
    border-radius: 30px;
    padding: 10px 18px;
    border: 1px solid #e9edef;
    width: 100%;
    max-width: 320px;
}

/* ========== АНИМАЦИИ ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.25s ease;
}

/* ========== ТЁМНАЯ ТЕМА ========== */
body.dark-theme {
    background-color: #121212;
    color: #ffffff;
}

body.dark-theme .card,
body.dark-theme .table-container,
body.dark-theme .navbar {
    background: #1c1c1e;
    border-color: #2c2c2e;
}

body.dark-theme .table thead th {
    background: #2c2c2e;
    color: #98989e;
}

body.dark-theme .table tbody td {
    color: #ffffff;
    border-color: #2c2c2e;
}

body.dark-theme .table tbody tr:hover {
    background: #2c2c2e;
}

body.dark-theme .form-control,
body.dark-theme .form-select {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #ffffff;
}

body.dark-theme .form-control:focus {
    border-color: #005bff;
}

body.dark-theme .btn-outline-primary {
    border-color: #005bff;
    color: #005bff;
}

body.dark-theme .search-box input {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #ffffff;
}

body.dark-theme footer {
    border-top-color: #2c2c2e;
    color: #8e8e93;
}

body.dark-theme .client-card {
    background: #1c1c1e;
    border-color: #2c2c2e;
}

body.dark-theme .courier-transport {
    background: #2c2c2e;
    color: #ffffff;
}
/* ========== ТЁМНАЯ ТЕМА ========== */
body.dark-theme {
    background-color: #121212;
    color: #ffffff;
}

body.dark-theme .card,
body.dark-theme .table-container,
body.dark-theme .navbar {
    background: #1c1c1e;
    border-color: #2c2c2e;
}

body.dark-theme .card-header {
    background: #1c1c1e;
    color: #ffffff;
    border-bottom-color: #2c2c2e;
}

body.dark-theme .table thead th {
    background: #2c2c2e;
    color: #98989e;
}

body.dark-theme .table tbody td {
    color: #ffffff;
    border-bottom-color: #2c2c2e;
}

body.dark-theme .table tbody tr:hover {
    background: #2c2c2e;
}

body.dark-theme .form-control,
body.dark-theme .form-select {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #ffffff;
}

body.dark-theme .form-control:focus {
    border-color: #005bff;
    box-shadow: 0 0 0 3px rgba(0,91,255,0.2);
}

body.dark-theme .form-label {
    color: #ffffff;
}

body.dark-theme .btn-outline-primary {
    border-color: #005bff;
    color: #005bff;
}

body.dark-theme .btn-outline-primary:hover {
    background: #005bff;
    color: #ffffff;
}

body.dark-theme .search-box input {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #ffffff;
}

body.dark-theme footer {
    border-top-color: #2c2c2e;
    color: #8e8e93;
}

body.dark-theme .client-card {
    background: #1c1c1e;
    border-color: #2c2c2e;
}

body.dark-theme .courier-transport {
    background: #2c2c2e;
    color: #ffffff;
}

body.dark-theme .stat-card {
    background: #1c1c1e;
}

body.dark-theme .alert-success {
    background: #1e3a2f;
    color: #88d4a3;
}

body.dark-theme .alert-danger {
    background: #3a1e1e;
    color: #ff8888;
}

body.dark-theme .badge-success {
    background: #1e3a2f;
    color: #88d4a3;
}

body.dark-theme .badge-warning {
    background: #3a2e1e;
    color: #ffb347;
}

body.dark-theme .badge-secondary {
    background: #2c2c2e;
    color: #98989e;
}

body.dark-theme .badge-info {
    background: #1e2a3a;
    color: #88bbff;
}

body.dark-theme .btn-edit {
    background: #2c2c2e;
    color: #ffffff;
}

body.dark-theme .btn-delete {
    background: #3a1e1e;
    color: #ff8888;
}

body.dark-theme .btn-reset {
    background: #3a2e1e;
    color: #ffb347;
}

body.dark-theme .role-admin {
    background: #1e3a2f;
    color: #88d4a3;
}

body.dark-theme .role-dispatcher {
    background: #1e2a3a;
    color: #88bbff;
}

body.dark-theme .role-courier {
    background: #3a2e1e;
    color: #ffb347;
}

body.dark-theme .status-free {
    background: #1e3a2f;
    color: #88d4a3;
}

body.dark-theme .status-busy {
    background: #3a2e1e;
    color: #ffb347;
}

body.dark-theme .status-off {
    background: #3a1e1e;
    color: #ff8888;
}
body.dark-theme .table {
    background: #1c1c1e;
}

body.dark-theme .table thead th {
    background: #2c2c2e;
    color: #98989e;
    border-color: #3a3a3c;
}

body.dark-theme .table tbody td {
    color: #ffffff;
    border-bottom-color: #2c2c2e;
}

body.dark-theme .table tbody tr:hover {
    background: #2c2c2e;
}

body.dark-theme .badge-secondary {
    background: #2c2c2e;
    color: #98989e;
}

body.dark-theme .badge-warning {
    background: #3a2e1e;
    color: #ffb347;
}
body.dark-theme .form-control {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #ffffff;
}

body.dark-theme .form-control::placeholder {
    color: #8e8e93;
}

body.dark-theme .form-control:focus {
    border-color: #005bff;
    box-shadow: 0 0 0 3px rgba(0,91,255,0.2);
}
body.dark-theme .table {
    background: #1c1c1e !important;
}

body.dark-theme .table thead th {
    background: #2c2c2e !important;
    color: #98989e !important;
    border-color: #3a3a3c !important;
}

body.dark-theme .table tbody td {
    color: #ffffff !important;
    border-bottom-color: #2c2c2e !important;
}

body.dark-theme .table tbody tr:hover {
    background: #2c2c2e !important;
}

body.dark-theme .badge-secondary {
    background: #2c2c2e !important;
    color: #98989e !important;
}

body.dark-theme .badge-warning {
    background: #3a2e1e !important;
    color: #ffb347 !important;
}

body.dark-theme .card-body {
    background: #1c1c1e !important;
}

body.dark-theme .table-responsive {
    background: #1c1c1e !important;
}
/* ========== ПРИНУДИТЕЛЬНЫЕ СТИЛИ ДЛЯ ТАБЛИЦЫ ЗАКАЗОВ ========== */
body.dark-theme .table,
body.dark-theme .table-responsive,
body.dark-theme .card-body.table-responsive {
    background-color: #1c1c1e !important;
}

body.dark-theme .table thead th {
    background-color: #2c2c2e !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

body.dark-theme .table tbody tr,
body.dark-theme .table tbody td {
    background-color: #1c1c1e !important;
    color: #ffffff !important;
    border-color: #3a3a3c !important;
}

body.dark-theme .table tbody tr:hover {
    background-color: #2c2c2e !important;
}

body.dark-theme .table tbody tr:hover td {
    background-color: #2c2c2e !important;
}
body.dark-theme .stat-card[style*="linear-gradient"] {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
}
.bg-warning-gradient {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.search-box {
    margin-bottom: 32px !important;
}
.navbar .nav-link.text-white:hover {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    transition: 0.2s;
}
/* ========== АДАПТАЦИЯ ДЛЯ ВСЕХ ЭКРАНОВ ========== */

/* Планшеты (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    .stat-card h3 {
        font-size: 28px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Телефоны (до 768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    /* Карточки статистики в ряд по 2 */
    .row {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .row .col-md-3 {
        width: calc(50% - 6px);
        flex: none;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card h3 {
        font-size: 22px;
    }
    
    .stat-card h5 {
        font-size: 12px;
    }
    
    /* Таблицы — горизонтальная прокрутка */
    .table-container,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* Кнопки */
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    /* Карточки меню управления */
    .card .btn-outline-primary,
    .card .btn-outline-success,
    .card .btn-outline-warning,
    .card .btn-outline-info {
        margin: 4px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Формы */
    .form-control,
    .form-select {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .form-card {
        max-width: 100%;
    }
    
    /* Заголовки */
    h2 {
        font-size: 20px;
    }
    
    /* Поиск */
    .search-box input {
        max-width: 100%;
        font-size: 14px;
    }
    
    /* Навигация */
    .navbar-brand {
        font-size: 18px;
    }
    
    footer {
        font-size: 11px;
        padding: 16px;
    }
}

/* Маленькие телефоны (до 480px) */
@media (max-width: 480px) {
    .row .col-md-3 {
        width: 100%;
    }
    
    .stat-card h3 {
        font-size: 20px;
    }
    
    .card-header {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .btn {
        width: 100%;
        margin: 4px 0;
    }
    
    .action-buttons {
        display: flex;
        gap: 6px;
    }
    
    .action-buttons a {
        flex: 1;
        text-align: center;
    }
}
body.dark-theme label {
    color: #ffffff;
}
.action-buttons {
    white-space: nowrap;
}
.table th:last-child,
.table td:last-child {
    width: 100px !important;
}