
/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f9fafb;
    --dark: #111827;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
.main-nav {
    background: white;
    box-shadow: 0 2px 8px var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--secondary);
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: var(--light);
    color: var(--primary);
}

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

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

.user-email {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 3rem;
    box-shadow: 0 20px 60px var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    width: 100%;
}

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

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

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

.btn-secondary:hover {
    background: #4b5563;
}

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

.btn-logout:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-view {
    background: var(--info);
    color: white;
}

.btn-edit {
    background: var(--warning);
    color: white;
}

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

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

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
}

.page-header h2 {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--secondary);
}

.page-header > div {
    display: flex;
    gap: 1rem;
}

/* Dashboard */
.dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.dashboard-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    transition: var(--transition);
    animation: slideUp 0.5s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px var(--shadow-lg);
}

.stat-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--light);
}

.stat-users .stat-icon {
    background: rgba(59, 130, 246, 0.1);
}

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

.stat-scans .stat-icon {
    background: rgba(245, 158, 11, 0.1);
}

.stat-content h3 {
    font-size: 2.5rem;
    color: var(--dark);
    font-weight: 700;
}

.stat-content p {
    color: var(--secondary);
    font-size: 1rem;
}

.recent-scans-section {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.recent-scans-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table thead {
    background: var(--light);
}

.modern-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.modern-table tbody tr {
    transition: var(--transition);
}

.modern-table tbody tr:hover {
    background: var(--light);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.role-super-admin {
    background: #9333ea;
    color: white;
}

.role-admin {
    background: var(--primary);
    color: white;
}

.role-standard-user {
    background: var(--success);
    color: white;
}

.role-device {
    background: var(--secondary);
    color: white;
}

/* Search and Filter */
.search-bar,
.filter-bar {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

/* User View */
.user-view,
.scan-view {
    animation: slideUp 0.5s ease;
}

.user-details-card,
.scan-details-card,
.form-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.user-avatar {
    text-align: center;
    margin-bottom: 2rem;
}

.avatar-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    box-shadow: 0 4px 12px var(--shadow);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.detail-item label {
    display: block;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.detail-item p {
    font-size: 1.1rem;
    color: var(--dark);
}

/* OBD Data */
.obd-data-section {
    margin-top: 2rem;
}

.obd-data-section h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.code-block {
    background: var(--dark);
    color: #10b981;
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Forms */
.form-card form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    font-weight: 500;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        padding: 1rem;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

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

    .action-buttons {
        flex-wrap: wrap;
    }

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

    .main-content {
        padding: 1rem;
    }
}

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

.user-list,
.user-form,
.scan-list {
    animation: fadeIn 0.5s ease;
}
