/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-sidebar: #0a0a0a;
    --border-color: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --blue-500: #6366f1;
    --blue-400: #818cf8;
    --orange-500: #f97316;
    --orange-400: #fb923c;
    --purple-500: #a855f7;
    --purple-400: #c084fc;
    --green-500: #10b981;
    --green-400: #34d399;
    --red-500: #ef4444;
    --red-400: #f87171;
    --yellow-500: #eab308;
    --yellow-400: #facc15;

    --gradient-blue: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-orange: linear-gradient(135deg, #f97316, #ec4899);
    --gradient-purple: linear-gradient(135deg, #a855f7, #ec4899);
    --gradient-green: linear-gradient(135deg, #10b981, #14b8a6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Header */
.top-header {
    height: 70px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px 0 0;
    gap: 32px;
}

.header-left {
    display: flex;
    align-items: center;
    padding-left: 0;
    margin-left: 0;
}

.logo-svg-header {
    width: 280px;
    height: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin-left: 0;
    padding-left: 16px;
}

.header-center {
    flex: 1;
    max-width: 600px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 80px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
}

/* Light theme adjustments */
body:not(.dark) .logo-text-wave {
    fill: url(#waveLightHeader);
}

body:not(.dark) .logo-text-base {
    fill: url(#gradientLightHeader);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.nav-item {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #1a1a1a;
    color: var(--text-secondary);
}

.nav-item.active {
    background: #2d2d2d;
    color: var(--text-primary);
}

.sidebar-footer {
    margin-top: auto;
}

.user-avatar,
.user-avatar-top {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.user-avatar-top {
    width: 40px;
    height: 40px;
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Search in Header */

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px 0 40px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #3d3d3d;
}

.date-display {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

/* Header Actions */

.icon-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #2d2d2d;
}

.notification-btn {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--blue-500);
    border-radius: 50%;
}

/* Content */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-title {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn-primary {
    padding: 10px 20px;
    background: white;
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #f0f0f0;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #2d2d2d;
}

.btn-danger {
    padding: 10px 20px;
    background: var(--red-500);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--red-400);
    transform: translateY(-1px);
}

.btn-outline {
    padding: 10px 18px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: #555;
}

.btn-ghost {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover {
    border-color: #555;
    color: var(--text-primary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #2d2d2d;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.stat-icon.blue {
    background: rgba(99, 102, 241, 0.1);
}

.stat-icon.orange {
    background: rgba(249, 115, 22, 0.1);
}

.stat-icon.purple {
    background: rgba(168, 85, 247, 0.1);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
}

.stat-icon-inner {
    width: 24px;
    height: 24px;
    border-radius: 8px;
}

.stat-icon.blue .stat-icon-inner {
    background: var(--blue-500);
}

.stat-icon.orange .stat-icon-inner {
    background: var(--orange-500);
}

.stat-icon.purple .stat-icon-inner {
    background: var(--purple-500);
}

.stat-icon.green .stat-icon-inner {
    background: var(--green-500);
}

.arrow-icon {
    color: var(--text-muted);
}

.stat-value {
    font-size: 32px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.stat-badge.positive {
    background: rgba(16, 185, 129, 0.2);
    color: var(--green-500);
}

.stat-badge.negative {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-500);
}

.stat-change-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chart-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.chart-action-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pie-chart-wrapper {
    display: flex;
    align-items: center;
    gap: 32px;
}

.pie-chart-wrapper canvas {
    max-width: 200px;
    max-height: 200px;
}

.sales-legend {
    flex: 1;
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.legend-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.legend-value {
    font-size: 14px;
    color: var(--text-muted);
}

/* Bottom Stats */
.bottom-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
}

.bottom-stat-item {
    display: flex;
    align-items: center;
    gap: 24px;
}

.circular-progress {
    position: relative;
    width: 96px;
    height: 96px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: #2d2d2d;
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--blue-500);
    stroke-width: 8;
    stroke-linecap: round;
}

.circular-icon {
    width: 96px;
    height: 96px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.bottom-stat-value {
    font-size: 36px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.bottom-stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.bottom-stat-desc {
    font-size: 14px;
    color: var(--text-muted);
}

.text-red {
    color: var(--red-400);
}

.text-orange {
    color: var(--orange-400);
}

/* Cars Section */
.filter-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.filter-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.search-filter {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.filter-actions {
    display: flex;
    gap: 12px;
}

.filter-select {
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Cars Grid */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.car-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.car-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.car-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-primary);
    transition: opacity 0.3s ease;
}

.car-image[loading="lazy"] {
    opacity: 0;
}

.car-image[loading="lazy"]:not([src=""]) {
    opacity: 1;
}

.car-image-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    color: var(--text-secondary);
}

.car-image-placeholder svg {
    color: var(--blue-500);
    opacity: 0.5;
}

.car-image-placeholder span {
    font-size: 14px;
    font-weight: 500;
}

.car-info {
    padding: 20px;
}

.car-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.car-price {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.car-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.car-detail {
    background: var(--bg-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.car-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.car-status.available {
    background: rgba(16, 185, 129, 0.2);
    color: var(--green-500);
}

.car-status.reserved {
    background: rgba(251, 146, 60, 0.2);
    color: var(--orange-400);
}

.car-status.sold {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-500);
}

.car-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    flex: 1;
    border: none;
}

.btn-sm.edit {
    background: #2d2d2d;
    color: var(--text-primary);
}

.btn-sm.delete {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red-500);
}

.btn-sm:hover {
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    z-index: 1001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 500;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-primary);
}

/* Form */
.car-form {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group textarea {
    height: 80px;
    padding: 12px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue-500);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

/* Settings */
#settings {
    position: relative;
    width: 100%;
    padding: 24px;
}

.settings-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
}

.settings-input {
    width: 100%;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Scrollbar */
.content::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.content::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #3d3d3d;
}

/* Inspection Requests */
.inspections-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.inspection-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.inspection-card:hover {
    border-color: var(--blue-500);
}

.inspection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.inspection-id {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.1);
    color: var(--yellow-500);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green-500);
}

.inspection-body {
    padding: 24px;
}

.inspection-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    gap: 12px;
}

.info-label {
    min-width: 150px;
    color: var(--text-secondary);
    font-size: 14px;
}

.info-value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.inspection-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.btn-danger {
    background: transparent;
    color: var(--red-500);
    border: 1px solid var(--red-500);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--red-500);
    color: white;
}

/* App Management */
.app-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--border-color);
}

.app-tab {
    padding: 14px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.app-tab:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.05);
}

.app-tab.active {
    color: var(--blue-500);
    border-bottom-color: var(--blue-500);
}

.app-tab-content {
    display: none;
}

.app-tab-content.active {
    display: block;
}

.app-section {
    margin-bottom: 48px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Home Cards Editor */
.home-cards-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.home-card-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    gap: 24px;
}

.card-left {
    width: 300px;
    flex-shrink: 0;
}

.card-image-upload {
    position: relative;
    margin-bottom: 16px;
}

.card-image-upload img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.btn-upload {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.card-image-upload:hover .btn-upload {
    opacity: 1;
}

.card-badge-editor {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-badge-editor label {
    font-size: 14px;
    color: var(--text-secondary);
}

.badge-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.badge-color {
    width: 40px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.card-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: auto;
}

.card-order {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.card-order span {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-primary);
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--blue-500);
}

/* News Cards Grid */
.news-cards-grid,
.home-cards-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.news-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.news-card:hover {
    transform: translateY(-4px);
    border-color: var(--blue-500);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.news-card-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card-icon {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.news-card-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 14px;
    background: var(--blue-500);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.news-card-content {
    padding: 20px;
}

.news-card-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.news-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.news-card-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-card-button-preview {
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--blue-500);
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    display: inline-block;
}

/* Users Page */
.users-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.users-tab-panel {
    display: none;
}

.users-tab-panel.active {
    display: block;
}

.users-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.users-tab {
    padding: 12px 22px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.users-tab.active {
    background: linear-gradient(120deg, #eb0a1e, #ff6b35);
    color: #111;
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(235, 10, 30, 0.25);
}

.users-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.users-search {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.users-search input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.users-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.users-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.users-filters select {
    min-width: 160px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.users-actions {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    cursor: pointer;
}

.user-card:hover {
    border-color: var(--blue-500);
    transform: translateX(4px);
}

.user-card-main {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
}

.user-avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 16px;
    background: linear-gradient(120deg, #eb0a1e, #ff6b35);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
}

.user-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.user-name-row h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.user-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.user-status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.user-role-chip {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.15);
    color: var(--blue-400);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.user-role-chip.manager {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange-400);
    border-color: rgba(249, 115, 22, 0.3);
}

.user-role-chip.admin {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red-400);
    border-color: rgba(239, 68, 68, 0.3);
}

.user-meta {
    color: var(--text-secondary);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.user-actions .btn-outline,
.user-actions .btn-ghost {
    padding: 6px 14px;
    font-size: 13px;
    white-space: nowrap;
}

.user-modal-content {
    max-width: 900px;
    width: 95%;
}

/* User Details Modal */
.modal-user-details {
    max-width: 700px;
    width: 90%;
}

.user-details-container {
    padding: 0;
}

.user-details-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.user-avatar-xlarge {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-details-title {
    flex: 1;
}

.user-details-title h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.user-details-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-details-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-details-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.user-details-row:hover {
    border-color: var(--blue-500);
    background: rgba(99, 102, 241, 0.05);
}

.user-details-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.user-details-label svg {
    color: var(--blue-400);
    flex-shrink: 0;
}

.user-details-value {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.user-details-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
    background: var(--bg-secondary);
}

.user-details-actions button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
}

.user-details-actions button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch input:checked+.slider {
    background: linear-gradient(120deg, #eb0a1e, #ff6b35);
}

.switch input:checked+.slider:before {
    transform: translateX(20px);
}

.messages-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.messages-toolbar h3 {
    margin: 0 0 4px;
}

.messages-toolbar p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.messages-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.message-info {
    flex: 1;
}

.message-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-title h4 {
    margin: 0;
    font-size: 15px;
    color: #fff;
}

.message-preview {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
}

.message-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.message-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.message-status {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.message-status.open {
    background: rgba(99, 102, 241, 0.18);
    color: #818cf8;
}

.message-status.assigned {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.message-status.closed {
    background: rgba(248, 113, 113, 0.18);
    color: #f87171;
}

.conversation-modal-content {
    max-width: 720px;
    width: 95%;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.conversation-user {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.conversation-meta {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.conversation-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 24px 24px;
    overflow: hidden;
}

.conversation-messages {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversation-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
}

.conversation-message.sent {
    align-self: flex-end;
    background: linear-gradient(120deg, #eb0a1e, #ff6b35);
}

.conversation-message.received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.conversation-message-meta {
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.conversation-input {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversation-input textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 14px;
    resize: vertical;
    min-height: 80px;
}

.conversation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    background: var(--bg-secondary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.empty-state h3 {
    margin: 16px 0 8px;
}

.empty-state p {
    margin: 0;
    color: var(--text-secondary);
}

/* News Modal */
.news-modal-content {
    max-width: 900px;
    width: 90%;
}

.news-editor-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 32px;
}

.news-editor-left,
.news-editor-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.news-image-upload {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
}

.news-image-upload img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.btn-upload-full {
    width: 100%;
    padding: 12px;
    background: var(--blue-500);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s;
}

.btn-upload-full:hover {
    background: var(--blue-400);
}

.icon-select-large {
    font-size: 16px;
    padding: 12px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .content {
        padding: 16px;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .date-display {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .cars-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .pie-chart-wrapper {
        flex-direction: column;
    }

    .users-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .users-filters {
        width: 100%;
    }

    .users-filters select {
        flex: 1;
    }

    .users-actions {
        width: 100%;
        margin-left: 0;
    }

    .user-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .user-card-main {
        width: 100%;
    }

    .user-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
    }

    .user-actions .btn-outline,
    .user-actions .btn-ghost {
        flex: 1;
    }

    .user-details-modal-content {
        width: 95%;
    }

    .user-details-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-details-grid {
        grid-template-columns: 1fr;
    }

    .user-details-actions {
        flex-direction: column;
    }

    .user-details-actions .btn-primary,
    .user-details-actions .btn-secondary,
    .user-details-actions .btn-outline {
        width: 100%;
    }

    .message-card {
        flex-direction: column;
    }

    .conversation-message {
        max-width: 100%;
    }

    .user-card-main {
        flex-direction: column;
    }

    .user-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Image Cropper Styles */
#imageCropModal {
    z-index: 2000;
    /* Выше чем обычные модальные окна (z-index: 1000) */
}

#imageCropModal .modal-overlay {
    z-index: 2000;
}

#imageCropModal .modal-content {
    z-index: 2001;
    /* Выше чем overlay модалки cropper */
}

.crop-container {
    max-width: 100%;
    height: 500px;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.crop-container img {
    max-width: 100%;
    display: block;
}

.crop-controls button {
    min-width: 120px;
}

/* ==================== CHAT PAGE ==================== */

.chat-page-header {
    margin-bottom: 24px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--bg-primary);
    border-color: var(--blue-500);
    color: var(--blue-400);
}

.btn-back svg {
    transition: transform 0.2s;
}

.btn-back:hover svg {
    transform: translateX(-4px);
}

.chat-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.chat-user-details h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.chat-user-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.chat-user-role {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(var(--blue-rgb, 99, 102, 241), 0.1);
    color: var(--blue-400);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.chat-user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.chat-user-status.online .status-indicator {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Анимация для badge при новых сообщениях */
@keyframes badgePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(235, 10, 30, 0.7);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(235, 10, 30, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(235, 10, 30, 0);
    }
}

.pulse-animation {
    animation: badgePulse 1s ease-in-out 3;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

/* Chat Messages */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-secondary);
}

.chat-messages-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.chat-empty-state .empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

.chat-messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Chat Message Bubble */
.chat-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.sent {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.chat-message.sent .chat-message-avatar {
    background: var(--gradient-blue);
}

.chat-message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message.sent .chat-message-content {
    align-items: flex-end;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.sent .chat-message-bubble {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.received .chat-message-bubble {
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 4px;
}

.chat-message-attachment {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-message-attachment img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

/* Chat Input */
.chat-input-container {
    padding: 20px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.chat-input {
    width: 100%;
    min-height: 48px;
    max-height: 150px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.chat-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin-left: auto;
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Typing Indicator */
.chat-typing-indicator {
    display: flex;
    gap: 12px;
    padding: 12px 0;
}

.chat-typing-indicator .chat-message-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Responsive Chat Page */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 160px);
    }

    .chat-header {
        padding: 16px;
    }

    .chat-user-avatar {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .chat-user-details h2 {
        font-size: 18px;
    }

    .chat-messages-container {
        padding: 16px;
    }

    .chat-message-content {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 16px;
    }

    .chat-send-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Incoming Messages Page */
.incoming-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.stat-item .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--blue-400);
    margin-bottom: 8px;
}

.stat-item .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.incoming-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.incoming-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.incoming-item:hover {
    border-color: var(--blue-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.incoming-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.incoming-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.incoming-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: white;
}

.incoming-user-details h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.incoming-user-details p {
    font-size: 12px;
    color: var(--text-secondary);
}

.incoming-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.incoming-time-value {
    font-size: 13px;
    color: var(--text-secondary);
}

.incoming-time-badge {
    background: var(--red-500);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Новый layout: сообщение слева, кнопки справа */
.incoming-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.incoming-message {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
}

.incoming-message-text {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

.incoming-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.incoming-actions .btn-secondary {
    padding: 6px 12px;
    font-size: 13px;
}

.incoming-actions .btn-primary {
    padding: 6px 12px;
    font-size: 13px;
}

.incoming-actions .btn-danger {
    padding: 6px 12px;
    font-size: 13px;
}

/* Badge for navigation */
.nav-item {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--red-500);
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* Animations */
@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.incoming-item.new-message {
    animation: slideInFromBottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Responsive */
@media (max-width: 768px) {
    .incoming-stats {
        grid-template-columns: 1fr;
    }

    .incoming-item {
        padding: 10px 12px;
    }

    .incoming-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .incoming-time {
        align-items: flex-start;
    }

    .incoming-content {
        flex-direction: column;
    }

    .incoming-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .messages-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .messages-toolbar-actions {
        width: 100%;
        flex-direction: column;
        gap: 12px;
    }

    .auto-refresh-toggle {
        width: 100%;
        justify-content: space-between;
    }

    #refreshUserMessagesBtn {
        width: 100%;
        justify-content: center;
    }

    /* User Details Modal - Responsive */
    .modal-user-details {
        width: 95%;
        max-height: 90vh;
    }

    .user-details-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px;
    }

    .user-avatar-xlarge {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .user-details-title h3 {
        font-size: 20px;
    }

    .user-details-meta {
        flex-direction: column;
        gap: 8px;
    }

    .user-details-info {
        padding: 16px;
    }

    .user-details-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }

    .user-details-label {
        min-width: unset;
        width: 100%;
    }

    .user-details-value {
        width: 100%;
    }

    .user-details-actions {
        flex-direction: column;
        gap: 8px;
        padding: 16px;
    }

    .user-details-actions button {
        width: 100%;
        justify-content: center;
    }
}


/* Car Gallery Manager */
.car-images-manager {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-primary);
}

/* Большое фото сверху */
.car-main-image-container {
    position: relative;
    width: 100%;
    margin: 0 auto 16px;
    border-radius: 8px;
    overflow: visible;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.car-main-image-container:hover {
    transform: scale(1.02);
}

.car-main-image {
    max-width: 600px;
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    background: transparent;
    border-radius: 8px;
}

.car-main-image-overlay {
    display: none;
}

/* Контейнер миниатюр */
.car-thumbnails-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.car-thumbnails-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Миниатюры как карточки */
.car-thumbnail-item {
    display: flex;
    flex-direction: column;
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    transition: all 0.2s;
    flex-shrink: 0;
}

.car-thumbnail-item:hover {
    border-color: var(--blue-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.car-thumbnail-item.active {
    border-color: var(--blue-500);
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.car-thumbnail-image-wrapper {
    width: 100%;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    cursor: pointer;
    overflow: hidden;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.car-thumbnail-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.car-thumbnail-remove {
    width: 100%;
    padding: 6px;
    background: var(--red-500);
    color: white;
    border: none;
    border-radius: 0 0 6px 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.car-thumbnail-remove:hover {
    background: var(--red-600);
}

/* Кнопка добавления фото */
.car-add-photo-btn {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.car-add-photo-btn:hover {
    border-color: var(--blue-500);
    color: var(--blue-500);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.car-add-photo-btn svg {
    width: 32px;
    height: 32px;
}