:root {
    --background-image: url(../img/background.jpg);
    --header-background-image: url(../img/header.png);
    --navbar-color: #1797be;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    background-image: var(--background-image);
    background-size: auto;
    background-position: center;
    background-repeat: repeat;
    background-attachment: fixed;
    overflow-x: hidden;
    max-width: 100vw;
}

.wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background-color: #1a252f;
    background-image: var(--header-background-image);
    background-size: auto;
    background-position: center;
    background-repeat: repeat;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h4 {
    margin: 0;
    color: white;
    font-size: 18px;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav {
    list-style: none;
    padding: 0;
}

.sidebar-nav .nav-item {
    margin: 0;
    display: block;
    width: 100%;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav .nav-link:hover {
    background-color: #34495e;
    color: white;
}

.sidebar-nav .nav-link.active {
    background-color: var(--navbar-color);
    color: white;
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 10px;
    text-align: center;
}

.sidebar-nav .nav-heading {
    padding: 15px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    color: #7f8c8d;
    font-weight: 600;
    display: block;
    width: 100%;
}

/* Скрываем пункт меню "Операторы" по умолчанию через JavaScript
   Правило ниже используется как fallback, но основной механизм - через JS */

/* Main Content */
.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.top-navbar {
    background-color: var(--navbar-color);
    background-image: var(--header-background-image);
    background-size: auto;
    background-position: center;
    background-repeat: repeat;
    padding: 15px 30px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 998;
    overflow: visible;
    min-width: 0;
}

.top-navbar .navbar-brand {
    overflow: hidden;
}

.top-navbar .navbar-user {
    overflow: visible;
}

.navbar-brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.top-navbar h5 {
    margin: 0;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.4;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1001;
}

.navbar-user .btn {
    padding: 5px 10px;
    font-size: 14px;
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.navbar-user .btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

.navbar-user span {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Desktop view - теперь используем dropdown как на мобильной */
.navbar-user-desktop {
    display: none;
}

.navbar-user-mobile {
    display: block;
}

/* Mobile user dropdown - теперь используется и на десктопе */
.navbar-user-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    position: relative;
    z-index: 1001;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.navbar-user-toggle:hover {
    color: #e0e0e0;
}

.navbar-user-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

.navbar-user-dropdown {
    display: none;
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    z-index: 10050;
    overflow: hidden;
}

.navbar-user-dropdown.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar-user-dropdown-content {
    padding: 15px;
}

.navbar-user-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.navbar-user-dropdown-item:last-child {
    border-bottom: none;
}

.navbar-user-dropdown-item i {
    width: 24px;
    margin-right: 10px;
    color: #7f8c8d;
}

.navbar-user-dropdown-item-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.navbar-user-dropdown-item-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}


.navbar-time {
    display: flex;
    gap: 20px;
    align-items: center;
}

.time-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-label {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 500;
}

.time-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    min-width: 80px;
}

.content-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
}

.panel {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel-body {
    padding: 20px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 10px;
}

/* Table */
.table {
    background: white;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Buttons */
.btn {
    margin-right: 5px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 12px;
}

/* Minimalistic buttons for experts table */
#expertsTable .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    margin-right: 8px;
    transition: all 0.2s ease;
}

#expertsTable .btn-sm:last-child {
    margin-right: 0;
}

#expertsTable .btn-sm i {
    font-size: 11px;
}

#expertsTable .btn-sm.btn-info {
    background-color: #e7f3ff;
    color: #0d6efd;
    border-color: #b3d9ff;
}

#expertsTable .btn-sm.btn-info:hover {
    background-color: #cfe2ff;
    border-color: #86b7fe;
}

#expertsTable .btn-sm.btn-danger {
    background-color: #fff5f5;
    color: #dc3545;
    border-color: #ffcccc;
}

#expertsTable .btn-sm.btn-danger:hover {
    background-color: #ffe0e0;
    border-color: #ff9999;
}

#expertsTable .btn-sm.btn-warning {
    background-color: #fffbf0;
    color: #ffc107;
    border-color: #ffe69c;
}

#expertsTable .btn-sm.btn-warning:hover {
    background-color: #fff3cd;
    border-color: #ffd966;
}

/* Cards */
.card {
    margin-bottom: 20px;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-title i {
    margin-right: 8px;
}

/* Switch */
.form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.form-check-input {
    cursor: pointer;
    width: 3em;
    height: 1.5em;
    transition: all 0.3s ease;
}

.form-check-input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-check-label {
    cursor: pointer;
    margin-left: 0.5rem;
    user-select: none;
}

.status-switch {
    margin-top: 0.25rem;
}

.status-text {
    font-size: 0.875rem;
    color: #495057;
    font-weight: 500;
}

/* Modal */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    color: #2c3e50;
    font-weight: 600;
}

/* Status badge */
.badge {
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
}

.badge.bg-purple {
    background-color: #6f42c1 !important;
    color: white;
}

.text-purple {
    color: #6f42c1 !important;
}

/* Category Selector */
.category-selector {
    position: relative;
}

.selected-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 40px;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background-color: #007bff;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    gap: 8px;
}

.category-tag .category-text {
    flex: 1;
}

.category-tag .remove-category {
    cursor: pointer;
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.category-tag .remove-category:hover {
    opacity: 1;
}

.category-tag .remove-category:focus {
    outline: none;
}

.selected-categories:empty::before {
    content: "Выберите категории из списка ниже";
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
}

#selectedPtoAddressesContainer:empty::before {
    content: "Добавьте адреса ПТО, используя поле ввода ниже";
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
}

/* Select2 стили для Bootstrap 5 */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--multiple {
    min-height: 38px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 2px 4px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #007bff;
    border: 1px solid #007bff;
    color: white;
    padding: 2px 8px;
    margin: 2px;
    border-radius: 0.25rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white;
    margin-right: 5px;
    cursor: pointer;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ffcccc;
}

.select2-container--default .select2-search--inline .select2-search__field {
    margin-top: 2px;
    padding: 0;
}

.select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #007bff;
    color: white;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    margin-right: 15px;
    transition: background-color 0.3s;
}

.mobile-menu-btn:hover {
    background: #34495e;
}

.mobile-menu-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.25);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.mobile-open {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .sidebar {
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.mobile-open {
        display: block;
        opacity: 1;
    }
    
    .sidebar-nav .nav-link {
        flex-direction: row;
        align-items: center;
    }
    
    .sidebar-nav .nav-link span {
        display: inline;
    }
    
    .sidebar-nav .nav-item {
        display: block;
        width: 100%;
    }
    
    .sidebar-nav .nav-heading {
        display: block;
        width: 100%;
    }
    
    .sidebar-header h4 {
        font-size: 14px;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .top-navbar {
        padding: 10px 15px;
        position: sticky;
        top: 0;
        z-index: 998;
    }
    
    .top-navbar h5 {
        font-size: 16px;
        margin: 0;
    }
    
    .navbar-time {
        display: none;
    }
    
    /* Mobile menu button */
    .mobile-menu-btn {
        display: block;
        position: relative;
        top: auto;
        left: auto;
        z-index: 999;
        margin-right: 10px;
    }
    
    .navbar-brand {
        flex: 1;
        min-width: 0;
    }
    
    .navbar-user {
        flex-shrink: 0;
        position: relative;
    }
    
    .navbar-user-toggle {
        font-size: 22px;
        padding: 5px 8px;
    }
    
    .navbar-user-dropdown {
        min-width: 220px;
    }
    
    .navbar-user-dropdown-content {
        padding: 12px;
    }
    
    .navbar-user-dropdown-item {
        padding: 8px 0;
    }
    
    .navbar-user-dropdown-item i {
        width: 20px;
        font-size: 16px;
    }
    
    .navbar-user-dropdown-item-label {
        font-size: 11px;
    }
    
    .navbar-user-dropdown-item-value {
        font-size: 13px;
    }
    
    .content-wrapper {
        padding: 15px;
        margin-top: 0;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }
    
    .page-header .d-flex {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .page-header .btn {
        width: 100%;
        margin-right: 0;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table thead th {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .table tbody td {
        padding: 8px 4px;
        font-size: 13px;
    }
    
    /* Buttons */
    .form-inline {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .form-inline .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0;
    }
    
    .d-flex.gap-2 {
        flex-direction: column;
    }
    
    .d-flex.gap-2 .btn {
        width: 100%;
        margin-right: 0;
    }
    
    /* Forms */
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .col-md-4,
    .col-md-6,
    .col-lg-6 {
        width: 100%;
        margin-bottom: 15px;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-header {
        padding: 10px 15px;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        max-width: calc(100% - 20px);
    }
    
    .modal-body {
        padding: 15px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-right: 0;
    }
    
    /* Panel */
    .panel-body {
        padding: 15px;
    }
    
    /* Input groups */
    .input-group {
        flex-direction: column;
    }
    
    .input-group .form-control {
        border-radius: 0.375rem;
        margin-bottom: 5px;
    }
    
    .input-group .btn {
        width: 100%;
        border-radius: 0.375rem;
    }
    
    /* Calendar styles for mobile */
    .write-clnd {
        flex-direction: column;
    }
    
    .date-selector,
    .time-selector {
        width: 100%;
        max-width: 100%;
    }
    
    .clnd-nav-wnames,
    .clnd-navw {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
    }
    
    .clnd-navd {
        padding: 5px;
        font-size: 12px;
    }
    
    /* Application items */
    .application-item {
        padding: 15px;
    }
    
    /* User items */
    .user-item {
        padding: 15px;
    }
    
    /* Status badges */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Select2 mobile */
    .select2-container {
        width: 100% !important;
    }
    
    /* Map container */
    #operatorMap {
        height: 300px !important;
    }
    
    /* Filter rows */
    .row.mb-3 {
        margin-bottom: 15px !important;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 14px;
    }
    
    /* Form horizontal layout - адаптация для мобильных */
    .form-row-horizontal {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .form-label-horizontal {
        min-width: 100%;
        max-width: 100%;
        text-align: left;
        padding-right: 0;
        padding-top: 0;
        margin-bottom: 4px;
        height: auto;
        justify-content: flex-start;
        font-size: 14px;
        font-weight: 600;
    }
    
    .form-control-horizontal {
        width: 100%;
    }
    
    /* Input groups в мобильной версии */
    .form-control-horizontal .input-group {
        flex-direction: column;
        gap: 5px;
    }
    
    .form-control-horizontal .input-group .form-control {
        width: 100%;
        margin-bottom: 0;
        border-radius: 0.375rem;
    }
    
    .form-control-horizontal .input-group .btn {
        width: 100%;
        margin-top: 0;
        border-radius: 0.375rem;
        white-space: normal;
    }
    
    .form-control-horizontal .input-group .btn:not(:first-child) {
        margin-top: 5px;
    }
    
    /* Кнопки действий формы */
    #cardForm .d-flex.justify-content-end.gap-2 {
        flex-direction: column;
        width: 100%;
    }
    
    #cardForm .d-flex.justify-content-end.gap-2 .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    #cardForm .d-flex.justify-content-end.gap-2 .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Фотографии на мобильных */
    #cardForm .row[name="photos"] .col-lg-6 {
        width: 100%;
        margin-bottom: 15px;
    }
    
    /* Заголовки секций */
    #cardForm h6.border-bottom {
        font-size: 15px;
        margin-top: 20px !important;
        margin-bottom: 15px !important;
        padding-bottom: 8px;
    }
    
    /* Улучшенные отступы для формы */
    #cardForm .col-lg-6 {
        margin-bottom: 0;
    }
    
    /* Select2 в мобильной версии */
    .form-control-horizontal .select2-container .select2-selection {
        height: auto;
        min-height: 38px;
    }
    
    /* Текстовые подсказки */
    .form-control-horizontal small.text-muted {
        font-size: 12px;
        margin-top: 4px;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .content-wrapper {
        padding: 10px;
    }
    
    .top-navbar {
        padding: 8px 10px;
    }
    
    .top-navbar h5 {
        font-size: 14px;
        overflow-wrap: break-word;
        word-break: break-word;
        line-height: 1.3;
    }
    
    .mobile-menu-btn {
        padding: 8px 12px;
        font-size: 16px;
        margin-right: 8px;
    }
    
    .navbar-user-toggle {
        font-size: 20px;
        padding: 4px 6px;
    }
    
    .navbar-user-dropdown {
        min-width: 200px;
    }
    
    .navbar-user-dropdown-content {
        padding: 10px;
    }
    
    .navbar-user-dropdown-item {
        padding: 6px 0;
    }
    
    .navbar-user-dropdown-item i {
        width: 18px;
        font-size: 14px;
    }
    
    .navbar-user-dropdown-item-label {
        font-size: 10px;
    }
    
    .navbar-user-dropdown-item-value {
        font-size: 12px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table thead th {
        font-size: 11px;
        padding: 6px 3px;
    }
    
    .table tbody td {
        padding: 6px 3px;
        font-size: 12px;
    }
    
    .btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .btn-sm {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .form-label {
        font-size: 14px;
    }
    
    .form-control,
    .form-select {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }
    
    .modal-body {
        padding: 10px;
    }
    
    .card-body {
        padding: 10px;
    }
    
    .panel-body {
        padding: 10px;
    }
    
    /* Форма на очень маленьких экранах */
    .form-label-horizontal {
        font-size: 13px;
    }
    
    .form-control-horizontal .form-control,
    .form-control-horizontal .form-select {
        font-size: 14px;
        padding: 8px 10px;
    }
    
    .form-control-horizontal .input-group {
        flex-direction: column;
    }
    
    .form-control-horizontal .input-group .btn {
        font-size: 12px;
        padding: 8px 10px;
        width: 100%;
        margin-top: 5px;
    }
    
    .form-control-horizontal .input-group .btn:first-of-type {
        margin-top: 0;
    }
    
    #cardForm h6.border-bottom {
        font-size: 14px;
        margin-top: 15px !important;
        margin-bottom: 12px !important;
    }
    
    .form-row-horizontal {
        margin-bottom: 10px;
    }
    
    /* Кнопки формы на маленьких экранах */
    #cardForm .d-flex.justify-content-end.gap-2 .btn {
        font-size: 14px;
        padding: 10px;
    }
    
    /* Улучшенные отступы для фотографий */
    #cardForm .row[name="photos"] {
        margin-left: 0;
        margin-right: 0;
    }
    
    #cardForm .row[name="photos"] .col-lg-6 {
        padding-left: 0;
        padding-right: 0;
    }
}

/* Compact form styles for create-diagnostic-card */
.content-wrapper .panel-body {
    padding: 15px;
}

.content-wrapper .form-label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.content-wrapper .mb-2 {
    margin-bottom: 8px !important;
}

.content-wrapper .mb-3 {
    margin-bottom: 12px !important;
}

.content-wrapper .mt-3 {
    margin-top: 12px !important;
}

.content-wrapper h6.border-bottom {
    font-size: 14px;
    font-weight: 600;
    padding-bottom: 6px;
    margin-bottom: 12px !important;
    margin-top: 0 !important;
}

.content-wrapper .form-control,
.content-wrapper .form-select {
    font-size: 14px;
    padding: 6px 10px;
    height: calc(1.5em + 12px + 2px);
}

.content-wrapper textarea.form-control {
    min-height: 60px;
    resize: vertical;
}

.content-wrapper .input-group .btn {
    font-size: 13px;
    padding: 6px 12px;
}

.content-wrapper .form-check {
    margin-bottom: 0;
}

.content-wrapper .form-check-label {
    font-size: 13px;
}

.content-wrapper small.text-muted {
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

.content-wrapper .file-input-wrapper {
    margin-bottom: 0;
}

/* Make form more compact */
#cardForm .row {
    margin-bottom: 0;
}

#cardForm .col-lg-6 {
    padding-left: 10px;
    padding-right: 10px;
}

/* Horizontal form layout - labels on left, inputs on right */
.form-row-horizontal {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
}

.form-label-horizontal {
    min-width: 180px;
    max-width: 180px;
    text-align: right;
    padding-right: 10px;
    padding-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    flex-shrink: 0;
    line-height: 1.5;
    height: calc(1.5em + 10px + 2px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.form-control-horizontal {
    flex: 1;
    min-width: 0;
}

/* Поля внутри обертки */
.form-control-horizontal .form-control,
.form-control-horizontal .form-select,
.form-control-horizontal select {
    width: 100%;
    font-size: 13px;
    padding: 5px 10px;
    height: calc(1.5em + 10px + 2px);
    line-height: 1.5;
}

.form-control-horizontal textarea.form-control {
    min-height: 50px;
    resize: vertical;
}

.form-control-horizontal .input-group {
    width: 100%;
}

.form-control-horizontal .input-group .form-control {
    flex: 1;
}

.form-control-horizontal .input-group .btn {
    font-size: 12px;
    padding: 5px 10px;
    white-space: nowrap;
}

.form-control-horizontal small.text-muted {
    font-size: 11px;
    display: block;
    margin-top: 2px;
    color: #6c757d;
    line-height: 1.2;
}

/* Убираем лишние отступы для правильного выравнивания */
.form-row-horizontal .form-control-horizontal:first-child {
    margin-top: 0;
}

/* Выравнивание для полей с подсказками - подсказки не влияют на выравнивание основного поля */
.form-control-horizontal .form-control,
.form-control-horizontal .form-select {
    margin-bottom: 0;
}

.form-control-horizontal .form-check {
    margin-top: 0;
    padding-top: 0;
}

/* Select2 adjustments for horizontal layout */
.form-control-horizontal .select2-container {
    width: 100% !important;
}

.form-control-horizontal .select2-container .select2-selection {
    height: calc(1.5em + 10px + 2px);
    font-size: 13px;
}

.form-control-horizontal .select2-container .select2-selection__rendered {
    line-height: calc(1.5em + 10px);
    padding-left: 10px;
}

/* Make form more compact overall */
#cardForm h6.border-bottom {
    font-size: 13px;
    font-weight: 600;
    padding-bottom: 4px;
    margin-bottom: 8px !important;
    margin-top: 8px !important;
}

#cardForm .panel-body {
    padding: 15px;
}

/* Adjust button sizes in horizontal layout */
.form-control-horizontal .btn-sm {
    font-size: 12px;
    padding: 4px 8px;
}

/* Reduce content wrapper padding for more compact form */
.content-wrapper {
    padding: 20px;
}

/* Compact form container */
#cardForm {
    margin-bottom: 0;
}

/* Reduce spacing between sections */
#cardForm .row {
    margin-left: -5px;
    margin-right: -5px;
}

#cardForm .col-lg-6 {
    padding-left: 5px;
    padding-right: 5px;
}

/* Цвет фона всех полей ввода */
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="file"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea,
.form-control,
.form-select,
.form-control-horizontal .form-control,
.form-control-horizontal .form-select,
.form-control-horizontal select,
.content-wrapper .form-control,
.content-wrapper .form-select {
    background-color: aliceblue !important;
}

/* Цвет фона для Select2 (марка ТС, модель ТС, марка шин) */
.select2-container .select2-selection,
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple,
.select2-container--default .select2-selection,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--multiple .select2-selection__rendered,
#cardBrand + .select2-container .select2-selection,
#cardModel + .select2-container .select2-selection,
#cardTypeTyre + .select2-container .select2-selection {
    background-color: aliceblue !important;
}

/* Для открытого состояния Select2 */
.select2-container--default.select2-container--open .select2-selection,
.select2-container--default.select2-container--open .select2-selection--single {
    background-color: aliceblue !important;
}

/* Цвет для иконки такси */
.bg-yellow {
    background-color: #fad732 !important;
    color: #ffffff !important;
}

/* Widget Styles */
.row.mb-4 > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.panel.widget {
    margin-bottom: 20px;
    border: none;
    overflow: hidden;
    height: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

/* Убеждаемся, что все виджеты в ряду имеют одинаковую высоту */
.row.mb-4 {
    display: flex;
    flex-wrap: wrap;
}

.row.mb-4 > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.row.mb-4 > [class*="col-"] > .panel.widget {
    flex: 1;
}

.panel.widget .row-table {
    display: table;
    width: 100%;
    margin: 0;
    height: 100%;
    table-layout: fixed;
    flex: 1;
}

.panel.widget .row-table > [class*="col-"] {
    display: table-cell;
    float: none;
    vertical-align: middle;
}

.panel.widget .pv-lg {
    padding-top: 30px;
    padding-bottom: 30px;
    padding-left: 15px;
    padding-right: 15px;
}

.panel.widget .text-sm {
    font-size: 0.875rem;
    line-height: 1.2;
    margin-bottom: 0;
    display: block;
}

.panel.widget br {
    line-height: 0.3;
    display: block;
    content: "";
    margin: 0;
    padding: 0;
}

.panel.widget #server-month,
.panel.widget #server-day,
.panel.widget #server-weekday-full,
.panel.widget #server-time {
    line-height: 1.2;
    margin: 0;
}

/* Background Colors */
.bg-primary {
    background-color: #007bff !important;
    color: #ffffff !important;
}

.bg-primary-dark {
    background-color: #0056b3 !important;
    color: #ffffff !important;
}

.bg-purple {
    background-color: #6f42c1 !important;
    color: #ffffff !important;
}

.bg-purple-dark {
    background-color: #5a32a3 !important;
    color: #ffffff !important;
}

.bg-green {
    background-color: #28a745 !important;
    color: #ffffff !important;
}

.bg-green-dark {
    background-color: #1e7e34 !important;
    color: #ffffff !important;
}

.bg-gray {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

.bg-gray-darker {
    background-color: #5a6268 !important;
    color: #ffffff !important;
}

.text-gray-darker {
    color: #ffffff !important;
}

.panel.widget .h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.panel.widget .text-uppercase {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.panel.widget .mt0 {
    margin-top: 0 !important;
}

.panel.widget .label {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.panel.widget .label.label-danger {
    background-color: #dc3545;
    color: #fff;
}

.panel.widget em {
    font-style: normal;
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro";
    font-weight: 900;
}

/* Bootstrap 5 compatibility for col-xs-* */
.col-xs-4 {
    width: 33.33333333%;
}

.col-xs-8 {
    width: 66.66666667%;
}

