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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f8f9fa;
    color: #212529;
    line-height: 1.6;
}

/* Layout */
#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.logo {
    padding: 20px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
}

.logo h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.sidebar nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: #334155;
    color: white;
}

.nav-link.active {
    background: #334155;
    border-left-color: #3b82f6;
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #334155;
    background: #0f172a;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f8f9fa;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card h3 {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}

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

.chart-container {
    background: white;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    height: 400px;
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

.chart-container canvas {
    max-height: 320px;
}

/* Tables */
.table-container {
    background: white;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.table-container h3 {
    margin-bottom: 20px;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

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

thead {
    background: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn-primary {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Forms */
.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.login-box h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
}

.login-box h2 {
    text-align: center;
    color: #7f8c8d;
    font-weight: 400;
    margin-bottom: 30px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #7f8c8d;
}

.warning {
    color: #e74c3c;
    font-weight: 600;
    margin-top: 10px;
}

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

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 8px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #7f8c8d;
}

.close:hover {
    color: #2c3e50;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

/* Error Message */
.error-message {
    background: #fee;
    color: #c00;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-info {
    background: #3498db;
    color: white;
}

.badge-warn {
    background: #f39c12;
    color: white;
}

.badge-error {
    background: #e74c3c;
    color: white;
}

.badge-success {
    background: #27ae60;
    color: white;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

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

/* Utility Classes */
.text-muted {
    color: #7f8c8d;
}

.text-small {
    font-size: 12px;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.text-center {
    text-align: center;
}

/* Device Info */
.device-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 10px;
}

.device-info strong {
    color: #2c3e50;
}

/* Activity Details */
.activity-details {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    max-width: 400px;
    overflow-x: auto;
}