/* Enhanced Users Page - Modern Top Navigation Design */

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #6366f1;
    --secondary-color: #6b7280;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Override body for new design */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    color: var(--gray-900);
    margin: 0;
    padding: 0;
}

/* Top Navigation Bar */
.top-navbar {
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideDown 0.5s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.brand-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: 2rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success-color);
}

.btn-refresh {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* Mobile Menu Button - FIXED */
.mobile-menu-btn {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.mobile-menu-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Main Container */
.users-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Header Section */
.users-header {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: none;
    animation: slideDown 0.3s ease;
}

.alert.show {
    display: block;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.btn-create,
.btn-export {
    padding: 0.75rem 1.5rem;
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-create {
    background: var(--primary-color);
}

.btn-create:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-export:hover {
    background: var(--gray-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Statistics Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.75rem;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card.critical {
    border-left-color: var(--danger-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 0.5rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    animation: countUp 1s ease;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Filters and Analytics Section */
.filters-analytics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.filter-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Quick Filters */
.filter-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}

.filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    color: var(--gray-700);
}

.filter-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

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

.filter-icon {
    font-size: 1.25rem;
}

/* User Statistics Grid */
.user-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.user-stat-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: default;
}

.user-stat-item:hover {
    background: var(--gray-100);
    transform: translateY(-2px);
}

.user-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.user-stat-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Activity Timeline */
.activity-timeline {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.activity-timeline::-webkit-scrollbar {
    width: 6px;
}

.activity-timeline::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.activity-timeline::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.activity-item {
    display: flex;
    align-items: start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.activity-item:hover {
    background: var(--gray-100);
}

.activity-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.activity-content {
    flex: 1;
}

.activity-user {
    font-weight: 600;
    color: var(--gray-900);
}

.activity-action {
    color: var(--gray-600);
}

.activity-time {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Search Section */
.search-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--gray-400);
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.search-clear:hover {
    color: var(--danger-color);
    transform: translateY(-50%) rotate(90deg);
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.users-table thead {
    background: var(--gray-50);
}

.users-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.users-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.users-table th.sortable:hover {
    background: var(--gray-100);
}

.users-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: all 0.3s ease;
    cursor: pointer;
}

.users-table tbody tr:hover {
    background: var(--gray-50);
}

.users-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-900);
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.user-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.875rem;
}

.user-email {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-badge.viewer {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.status-inactive {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

/* Protected Badge */
.protected-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    margin-left: 0.25rem;
    text-transform: uppercase;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn-small {
    padding: 0.25rem 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    color: var(--gray-700);
    font-weight: 500;
}

.action-btn-small:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.action-btn-small.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.3);
}

.action-btn-small.danger:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Last Login Info */
.last-login-info {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
}

.last-login-date {
    color: var(--gray-700);
    font-weight: 500;
}

.last-login-time {
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* Pagination */
.pagination-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.page-btn {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

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

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 1rem 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 100;
    animation: slideUp 0.3s ease;
}

.bulk-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.bulk-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.bulk-btn.resolve {
    background: var(--success-color);
    color: white;
}

.bulk-btn.acknowledge {
    background: var(--primary-color);
    color: white;
}

.bulk-btn.export {
    background: var(--secondary-color);
    color: white;
}

.bulk-btn.delete {
    background: var(--danger-color);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--gray-600);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-checkbox {
    margin-right: 0.5rem;
}

.btn-action,
.btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-action:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* Loading & Empty States */
.loading-state,
.empty-state {
    text-align: center;
    padding: 4rem;
    color: var(--gray-500);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

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

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Legacy compatibility - Only hide old sidebar elements */
.mobile-overlay,
.main-container,
.vehicle-sidebar {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .filters-analytics-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 768px) {

    /* Mobile Menu Button - NOW VISIBLE */
    .mobile-menu-btn {
        display: flex !important;
    }

    .nav-menu {
        display: none;
    }

    .nav-actions {
        display: none;
    }

    .nav-container {
        padding: 0 1rem;
        gap: 1rem;
    }

    .filters-analytics-section {
        grid-template-columns: 1fr;
    }

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

    .filter-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .users-table th.th-email,
    .users-table td.td-email {
        display: none;
    }

    .pagination-section {
        flex-direction: column;
        gap: 1rem;
    }

    .bulk-actions-bar {
        flex-direction: column;
        width: calc(100% - 2rem);
        left: 1rem;
        transform: none;
    }

    .header-actions {
        flex-direction: column;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-btn-small {
        width: 100%;
        text-align: center;
    }

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

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }

    .filter-buttons {
        grid-template-columns: 1fr;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}