:root {
    --primary-color: #000000;
    --secondary-color: #f5f5f5;
    --text-color: #333333;
    --text-light: #888888;
    --border-color: #e0e0e0;
    --bg-color: #f9f9f9;
    --white: #ffffff;
    --active-color: #e8f5e9;
    --active-text: #4caf50;
    --inactive-color: #ffebee;
    --inactive-text: #f44336;
    --deleted-color: #f5f5f5;
    --deleted-text: #9e9e9e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

.cpanel-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background-color: var(--white);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--secondary-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 40px;
}

.logo i {
    font-size: 24px;
}

.menu-section {
    margin-bottom: 32px;
}

.menu-title {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.menu-list {
    list-style: none;
}

.menu-list li {
    margin-bottom: 8px;
}

.menu-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-color);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.menu-list a i {
    width: 20px;
    text-align: center;
    color: var(--text-light);
}

.menu-list li.active a {
    background-color: var(--white);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.menu-list li.active a i {
    color: var(--primary-color);
}

.menu-list a:hover {
    background-color: rgba(0,0,0,0.05);
}

.sub-menu {
    list-style: none;
    padding-left: 32px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.sub-menu li {
    margin-bottom: 4px;
}

.sub-menu a {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-light);
    background: transparent !important;
    box-shadow: none !important;
}

.sub-menu a:hover {
    color: var(--primary-color);
}

/* Vehicles chevron rotation transition */
#menu-vehicles .fa-chevron-down {
    transition: transform 0.25s ease;
}

.sub-menu li.active a {
    color: #5c5cff;
    font-weight: 600;
}

.sub-menu .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-light);
    display: inline-block;
    margin-right: 8px;
}

.sub-menu li.active .dot {
    background-color: #5c5cff;
}

.help-section {
    margin-top: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 20px;
    width: 300px;
}

.search-bar i {
    color: var(--text-light);
    margin-right: 8px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
}

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

.notification-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

/* User Dropdown */
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 240px;
    z-index: 1000;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease;
}

.user-dropdown.show {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.user-dropdown-header .dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
}

.dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.dropdown-email {
    font-size: 12px;
    color: var(--text-light);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.15s ease;
}

.user-dropdown-item:hover {
    background: var(--secondary-color);
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.user-dropdown-item.logout-item {
    color: #e53e3e;
}

.user-dropdown-item.logout-item i {
    color: #e53e3e;
}

.user-dropdown-item.logout-item:hover {
    background: #fff5f5;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-size: 14px;
    font-weight: 600;
}

.user-info .email {
    font-size: 12px;
    color: var(--text-light);
}

/* Page Content */
.page-content {
    padding: 24px 32px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

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

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

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

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

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--secondary-color);
}

.btn-primary {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: var(--white);
}

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

.btn-dark {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: var(--white);
}

.btn-icon {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    background: none;
    border: none;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab.active {
    color: var(--text-color);
    font-weight: 600;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

/* Table Section */
.table-section {
    background: var(--white);
    border-radius: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
    min-height: 0;
}

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

.table-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-title h2 {
    font-size: 16px;
    font-weight: 600;
}

.badge {
    background: var(--secondary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
}

.search-box i {
    color: var(--text-light);
    margin-right: 8px;
    font-size: 12px;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 150px;
}

.table-container {
    overflow-x: auto;
    flex: 1;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

.users-table th,
.users-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    white-space: nowrap;
}

.users-table th {
    color: var(--text-light);
    font-weight: 500;
    font-size: 12px;
    text-transform: capitalize;
}

/* Column widths */
.users-table th:nth-child(1),
.users-table td:nth-child(1) { width: 36px; }
.users-table th:nth-child(2),
.users-table td:nth-child(2) { min-width: 160px; }  /* User Name */
.users-table th:nth-child(3),
.users-table td:nth-child(3) { min-width: 170px; }  /* Email */
.users-table th:nth-child(4),
.users-table td:nth-child(4) { width: 80px; }       /* Role */
.users-table th:nth-child(5),
.users-table td:nth-child(5) { width: 80px; }       /* Status */
.users-table th:nth-child(6),
.users-table td:nth-child(6) { min-width: 110px; }  /* Add Date */
.users-table th:nth-child(7),
.users-table td:nth-child(7) { min-width: 110px; }  /* Last Active */
.users-table th:nth-child(8),
.users-table td:nth-child(8) { min-width: 110px; }  /* Last IP */
.users-table th:nth-child(9),
.users-table td:nth-child(9) { min-width: 120px; }  /* Country */
.users-table th:nth-child(10),
.users-table td:nth-child(10) { width: 60px; text-align: center; }  /* Vehicles */
.users-table th:nth-child(11),
.users-table td:nth-child(11) { width: 60px; text-align: center; }  /* Access */
.users-table th:nth-child(12),
.users-table td:nth-child(12) { width: 50px; text-align: center; }  /* Action */

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

.user-cell img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-cell-info {
    display: flex;
    flex-direction: column;
}

.user-cell-info .name {
    font-weight: 600;
    color: var(--text-color);
}

.user-cell-info .desc {
    font-size: 11px;
    color: var(--text-light);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

.status-active {
    background-color: var(--active-color);
    color: var(--active-text);
    border: 1px solid #c8e6c9;
}

.status-inactive {
    background-color: var(--inactive-color);
    color: var(--inactive-text);
    border: 1px solid #ffcdd2;
}

.status-deleted {
    background-color: var(--deleted-color);
    color: var(--deleted-text);
    border: 1px solid #e0e0e0;
}

/* Group badge */
.group-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
    white-space: nowrap;
}

/* Settings dropdown */
.settings-dropdown-wrap {
    display: inline-block;
    position: relative;
}
.settings-dropdown-wrap .action-dropdown {
    top: 100%;
    margin-top: 4px;
}

/* Country cell with flag */
.country-cell {
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-color);
}

.country-cell img {
    border-radius: 2px;
    margin-right: 7px;
    vertical-align: middle;
    box-shadow: 0 0 1px rgba(0,0,0,.3);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #4caf50;
}

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

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Action Menu */
.action-menu {
    position: relative;
    display: inline-block;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-light);
}

.action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--white);
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 6px;
    z-index: 1;
    border: 1px solid var(--border-color);
}

.action-dropdown.show {
    display: block;
}

.action-dropdown a {
    color: var(--text-color);
    padding: 10px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    white-space: nowrap;
}

.action-dropdown a:hover {
    background-color: var(--secondary-color);
}

.action-dropdown a.delete-action {
    color: #e53e3e;
}

.action-dropdown a.delete-action i {
    color: #e53e3e;
}

.action-dropdown a.delete-action:hover {
    background-color: #fff5f5;
}

/* Danger Button */
.btn-danger {
    background-color: #e53e3e;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s ease;
}

.btn-danger:hover {
    background-color: #c53030;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    margin-top: 16px;
}

.showing-text {
    font-size: 13px;
    color: var(--text-light);
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--white);
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-content.modal-wide {
    width: 640px;
    max-width: 95vw;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Vehicles Panel Styles */
.vehicles-tabs {
    gap: 32px;
}

.vehicles-tabs .tab {
    padding: 16px 0;
    font-size: 15px;
}

.vehicles-tabs .badge {
    background: var(--secondary-color);
    color: var(--text-light);
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.vehicles-tabs .tab.active .badge {
    background: #e0e0ff;
    color: #5c5cff;
}

.vehicles-table-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.table-actions-left {
    display: flex;
    gap: 16px;
    align-items: center;
}

.table-actions-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.vehicles-table th,
.vehicles-table td {
    padding: 16px 24px;
}

.vehicles-table th {
    background: #fcfcfc;
    font-weight: 600;
    color: var(--text-color);
}

.vehicle-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vehicle-cell img {
    width: 40px;
    height: 28px;
    object-fit: contain;
}

.operator-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.operator-cell img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.status-in-shop {
    background-color: #f3e5f5;
    color: #8e24aa;
    border: 1px solid #e1bee7;
}

.status-service {
    background-color: #fff8e1;
    color: #fbc02d;
    border: 1px solid #ffecb3;
}

.items-per-page {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-light);
}

.items-per-page select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
}

.btn-page {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 500;
}

.btn-page.active {
    background: var(--primary-color);
    color: var(--white);
}

.btn-page:hover:not(.active) {
    background: var(--secondary-color);
}

/* ── Modal Sidebar Layout ── */
.modal-layout {
    display: flex;
    min-height: 350px;
}

.modal-sidebar {
    width: 160px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid var(--border-color);
    padding: 12px 0;
    border-radius: 0 0 0 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.modal-nav-item:hover {
    background: #eef2f7;
    color: var(--text-dark);
}

.modal-nav-item.active {
    color: var(--primary-color);
    background: #eef2ff;
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.modal-nav-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}

.modal-tab-content {
    flex: 1;
    min-width: 0;
    padding: 24px;
    overflow-y: auto;
    max-height: 65vh;
}

.modal-tab-pane {
    display: none;
}

.modal-tab-pane.active {
    display: block;
}

/* ── Privileges Toggles ── */
.priv-section {
    margin-bottom: 20px;
}

.priv-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.priv-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.priv-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
}

.priv-toggle:hover {
    background: #f1f5f9;
}

.priv-toggle input[type="checkbox"] {
    display: none;
}

.priv-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.priv-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.priv-toggle input:checked + .priv-slider {
    background: var(--primary-color);
}

.priv-toggle input:checked + .priv-slider::after {
    transform: translateX(16px);
}
