*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f4f5f7 !important;
}

:root {
    --bg-primary-light: #007c8912;
    --primary-color: #007c89;
    --border-color: #E5E5E5;
    --text-main: #1A1A1A;
    --text-muted: #8E8E93;
    --bg-light: #F9FAFB;
    --primary-purple: #6343E4;
    --hover-bg: #F2F2F7;
}


.search-container {
    position: relative;
    margin-bottom: 32px;
}

.search-bar {
    width: 100%;
    padding: 10px 12px 10px 35px;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background-color: transparent;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 12px;
    padding-right: 12px;
    white-space: nowrap;
}

.nav-list {
    list-style: none;
    padding: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s ease;
    margin-bottom: 4px;
}

.nav-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--bg-primary-light);
    color: var(
    --text-main);
}
/* --- HEADER STYLES --- */
.header {
    width: 100%;
    height: 55px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
display: flex;
align-items: center;
gap: 16px;
height: 100%;
}

.logo {
    width: 100%;
    height: 100%;
    margin-left: 24px;
    display: flex;
    align-items: center;
    position: relative;
}

.logo img {
    width: 160px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.header-right {
    display: flex;
    align-items: center;
    padding-right: 24px;
    height: 100%;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
}

.profile-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: white;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background-color: #DDD;
    object-fit: cover;
}

.username {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.arrow-down {
    font-size: 10px;
    color: var(--text-muted);
}

/* --- MAIN LAYOUT ADJUSTMENT --- */
.container {
    display: flex;
}

.sidebar {
    width: 260px;
    height: -webkit-fill-available;
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    padding-top: 0px;
    box-sizing: border-box;
    position: fixed;
    left: 0;
    top: 55px;
    padding-top: 16px;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-y: scroll;
}

/* Sidebar search moved/styled as per original */
.search-container {
    position: relative;
    margin-bottom: 24px;
}

.search-bar {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background-color: var(--bg-light);
}

.section-label-m::before {
    content: '';
    width: 4px;
    height: 10px;
    position: absolute;
    background: var(--primary-color);
    left: 0;
    right: 0;
    border-radius: 15px;
}

.section-label-m {
    position: relative;
    display: flex;
    align-items: center;
    margin: 18px 0;
}

.section-label-m::after {
    content: '';
    width: 100%;
    height: 1px;
    background: var(--border-color);
}

.logo::after {
    content: '';
    width: 1px;
    height: 25px;
    background: var(--border-color);
    right: 0;
    position: absolute;
}

.nav-item ion-icon {
    font-size: 18px;
}

.nav-item.active ion-icon {
    color: var(--primary-color);
}

.header-logo {
    display: flex;
    align-items: center;
    width: 260px;
    height: 100%;
    position: relative;
}

.device-list-item .device-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 160px;
}

.battery-net-connections {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    background: var(--border-color);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #7f8c8d;
    width: 155px;
}

.battery-data {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 45px;
}

.net-info {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 80px;
}

.battery-data span {
    font-size: 12px;
}

.net-info span {
    font-size: 12px;
}

.battery-data ion-icon, .net-info ion-icon {
    font-size: 16px;
}

span.device-name {
    font-size: 14px;
}

.device-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-name ion-icon {
    padding-top: 2px;
}

.device-name-list {
    width: 240px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    padding: 3px 10px;
}

.device_ic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #eaecf0;
    border-radius: 50%;
    min-width: 35px;
    font-size: 22px;
    color: #282930;
}


/* Main-body */

.main-body {
    width: -webkit-fill-available;
    height: 100%;
    margin-left: 260px;
    padding: 20px;
}

.metrics-grid {
    display: flex;
    gap: 16px;
}

.metric-card {
    background: white;
    flex: 1;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); /* Very subtle shadow */
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid;
    border-color: var(--border-color);
}

/* Icon Box Styles */
.icon-box {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 8px;
}

.icon-box img {
    width: 100%;
    padding: 5px;
}

.orange { background: #FFF7ED; color: #F97316; }
.blue   {background: #EFF6FF;color: #3B82F6;}
.green  { background: #F0FDF4; color: #22C55E; }
.purple { background: #FAF5FF; color: #A855F7; }

.label {
    font-size: 14px;
    color: #8E8E93;
    font-weight: 500;
}

.value {
    font-size: 28px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 4px 0;
}

/* Trend Indicators */
.trend {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend.up { color: #22C55E; }
.trend.down { color: #EF4444; }

.trend span {
    color: #8E8E93;
    font-weight: 400;
    margin-left: 2px;
}

/* Usages */

.usage-dashboard {
            background: white;
            border-radius: 12px;
            padding: 24px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            margin: 16px 0;
            border: 1px solid;
            border-color: var(--border-color);
        }

        .usage-dashboard h2 {
            margin-bottom: 25px;
            color: #1e293b;
            font-size: 20px;
        }

        .usage-layout {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            align-items: start;
        }

        .chart-section {
            height: 380px;
            width: 600px;
            position: relative;
        }

        .chart-section canvas {
            max-height: 380px;
        }

        .app-list-section {
            background: #f8fafc;
            border-radius: 12px;
            padding: 20px;
            height: 380px;
            overflow: hidden;
            overflow-y: scroll;
        }

        .app-list-section h3 {
            margin-bottom: 20px;
            color: #1e293b;
            font-size: 18px;
            text-align: center;
        }

        #appUsageList {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .app-icon {
            flex: 0 0 40px;
            width: 40px;
            height: 40px;
            text-align: center;
            background: #eaf3ff;
            border-radius: 8px;
            padding: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-usage-item {
    display: flex;
    align-items: center;
    gap: 12px;                    /* space between icon & content */
    padding: 12px 16px;           /* your padding */
    border-radius: 12px;
    background: #f9f9f9;
    width: 100%;                  /* full width of parent */
    box-sizing: border-box;       /* very important! */
    overflow: hidden;             /* contain everything inside */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid;
    border-color: var(--border-color);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Main content area — takes remaining space */
.app-name-time {
    flex: 1;                      /* take all remaining width */
    min-width: 0;                 /* crucial! allows shrinking + ellipsis */
    display: flex;
    flex-direction: column;       /* name on top, time below */
    gap: 3px;
    overflow: hidden;             /* contain text overflow */
}

/* App name — ellipsed if too long */
.app-name {
    font-weight: 600;
    font-size: 16px;
    color: #0891b2;
    white-space: nowrap;          /* force single line */
    overflow: hidden;
    text-overflow: ellipsis;      /* ... at the end */
}

/* Time — fixed/small on right or bottom */
.app-time {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    font-weight: 500;
}

        /* Responsive */
        @media (max-width: 900px) {
            .usage-layout {
                grid-template-columns: 1fr;
            }
        }

.con-name {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.confirm-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.confirm-dialog.active {
    opacity: 1;
    display: flex !important;
}

.confirm-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 400px;
    text-align: center;
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease;
}

.confirm-dialog.active .confirm-box {
    transform: scale(1);
    opacity: 1;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

.confirm-buttons button {
    padding: 10px 24px;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

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



.toast {
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        background: #2ecc71;
        color: white;
        padding: 14px 28px;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        z-index: 2000;
        font-weight: 500;
        opacity: 0;
        transition: opacity 0.4s ease, transform 0.4s ease;
    }
    .toast.success { background: #2ecc71; }
    .toast.error   { background: #e74c3c; }
    .toast.fade-out { opacity: 0; transform: translate(-50%, 20px); }



.device-section {
    /* margin-left: 20px; */
    cursor: pointer;
    /* position: relative; */
}

.device-section:hover #deviceOverlay {
    display: block;
}

.no-device-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e74c3c;
    font-weight: 500;
    padding: 8px 16px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
}

.device-name-list:hover {
    background: #e9ecef85;
}

.device_ic ion-icon {
    font-size: 28px;
    color: #3498db;
}

.device-info {
    display: flex;
    flex-direction: column;
    /* padding: 0 10px; */
    gap: 2px;
}

.device-name {
    font-weight: bold;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 4px;
}

.device-name span {
    max-width: 152px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.device-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

/* Overlay Styles */
.device-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    min-width: 320px;
    z-index: 100;
    margin-top: 8px;
    padding: 16px;
}

.overlay-content h4 {
    margin: 0 0 12px;
    color: #2c3e50;
}

.device-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.device-list-item:hover,
.device-list-item.active {
    background: #e9ecef85;
}

.device-list-item .tick {
    color: #27ae60;
    font-size: 20px;
    visibility: hidden;
}

.device-list-item.active .tick {
    visibility: visible;
}

.add-device-section {
    margin-top: 16px;
    text-align: center;
}

.add-device-btn {
    width: 100%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.device-r-ol {
    position: relative;
}

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

#loadMoreBtn {
    border: 0;
    border-radius: 40px;
    font-family: 'Inter', sans-serif;
    font-size: 18px !important;
    width: 200px;
    padding: 14px 30px !important;
    cursor: pointer;
}

.add-device-section a {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    text-decoration: none;
    gap: 6px;
    font-size: 16px;
    border-radius: 6px;
}

.add-device-section ion-icon {
    font-size: 22px;
}

.status-line {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    color: #1f2c3a;
    width: 160px;
}

.status-line span {
    display: flex;
    align-items: center;
}

span.battery-perc, span.net-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block !important;
    padding-left: 5px;
}

span.ellipse-text {
    max-width: 100%;
}

/* Application list page */

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
        }
        .page-title {
            font-size: 28px;
            font-weight: 600;
            color: #212529;
        }
        .search-wrapper {
            position: relative;
            width: 300px;
        }
        .search-input {
            width: 100%;
            padding: 10px 12px 10px 40px !important;
            border: 1px solid #ced4da;
            border-radius: 6px;
            font-size: 15px;
            transition: border-color 0.2s;
        }
        .search-input:focus {
            outline: none;
            border-color: #0d6efd;
            box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
        }
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: #6c757d;
        }
        .refresh-button {
            background: white;
            border: 1px solid #ced4da;
            border-radius: 50%;
            width: 38px;
            height: 38px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }
        .refresh-button:hover {
            background: #f1f3f5;
            border-color: #adb5bd;
        }
        .section-title {
            font-size: 20px;
            font-weight: 600;
            color: #212529;
            margin-bottom: 15px;
        }
        .card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.03);
            overflow: hidden;
            border: 1px solid;
            border-color: var(--border-color);
        }
        .table-head {
            background: #f8f9fa;
            border-bottom: 1px solid #dee2e6;
            padding: 12px 20px;
            font-size: 14px;
            font-weight: 500;
            color: #6c757d;
            border-color: var(--border-color);
        }
        .table-row {
            display: grid;
            align-items: center;
            padding: 14px 20px;
            border-bottom: 1px solid #f0f0f0;
            transition: background 0.15s;
        }
        .table-row:hover {
            background: #f8f9fa;
        }
        .app-cell {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .app-cell .app-icon {
            min-width: 48px;
            max-width: 48px;
            height: 48px;
            border-radius: 10px;
            background: #e9ecef;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }
        .app-cell .app-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .app-cell .app-name {
            font-weight: 500;
            color: #212529;
            font-size: 15px;
        }
        .app-time {
            color: #6c757d;
            font-size: 14px;
        }
        .arrow {
            color: #0d6efd;
            font-size: 20px;
            font-weight: bold;
        }
        .empty-state {
            padding: 30px;
            text-align: center;
            color: #6c757d;
            font-size: 16px;
        }
        .table-row.all-app-row:last-child {
            border-bottom: 0;
        }
        
        .table-row.recent-app-row:last-child {
            border-bottom: 0;
        }
        .applist-name-pkg {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 2px;
        }
        @media (max-width: 768px) {
            .main-body { padding: 20px; }
            .page-header { flex-direction: column; align-items: flex-start; gap: 15px; }
            .search-wrapper { width: 100%; }
        }

/* Binding page */


        .bind-container {
            max-width: 500px;
            margin: 80px auto;
            text-align: center;
            padding: 40px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        }
        .qr-code {
            margin: 30px 0;
            padding: 20px;
            background: #f8f9fa;
            border-radius: 12px;
        }
        .qr-code img {
            width: 200px;
            height: 200px;
        }
        .instructions {
            margin: 30px 0;
            color: #666;
        }

/* ================================================================================================================================= */
.current-active-device-info {
    position: absolute;
    background: red;
    z-index: 100;
    padding-left: 50px;
}
