@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: block;
    min-height: 100vh;
}

/* Modern Top Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

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

.brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

/* Desktop Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

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

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

.nav-link i {
    font-size: 1.1rem;
}

/* User Profile in Nav */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
    margin-left: 1rem;
}

.nav-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-user-info {
    display: block;
}

.nav-user-info div:first-child {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.nav-user-info div:last-child {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Mobile Menu Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

/* Main Content Adjustments */
.main-content {
    margin: 0 auto;
    padding: 2rem 1.5rem;
    max-width: 1400px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

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

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}

.stat-icon.green {
    background: #dcfce7;
    color: #166534;
}

.stat-icon.red {
    background: #fee2e2;
    color: #991b1b;
}

.stat-info .label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.card {
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.card-body {
    padding: 1.5rem;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #f8fafc;
}

/* Badges & Buttons */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-online {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.badge-offline {
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Detail Page Specifics */
.detail-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.device-id {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.os-logo {
    width: 64px;
    height: 64px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.spec-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.75rem;
}

.spec-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.spec-val {
    font-weight: 600;
    color: #334155;
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .nav-user-info {
        display: none;
    }
}

@media (max-width: 768px) {
    .max-w-container {
        padding: 0 1rem;
    }

    .mobile-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        /* navbar height */
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        gap: 0;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 1rem;
        border-radius: 0;
        border-bottom: 1px solid #f1f5f9;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-user {
        display: none;
        /* Simplify mobile menu by hiding user partial, or move it inside nav-links */
    }

    /* Move user info to bottom of nav-links on mobile? */
    /* For simplicity, we just hide the top right user block and maybe rely on a settings link */

    .detail-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .device-id {
        width: 100%;
    }
}