/* BatteryCloud - BudgetThuis Theme */
/* Custom CSS matching the Next.js UI exactly */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Londrina+Solid:wght@100;300;400;900&family=Open+Sans:wght@400;600;700&display=swap');

/* ===== CSS Variables - BudgetThuis Brand ===== */
:root {
    /* BudgetThuis brand colors - Precision Palette */
    --background: #F8FAFC;
    --foreground: #1A1A1A;

    --card: #FFFFFF;
    --card-foreground: #1A1A1A;

    --popover: #FFFFFF;
    --popover-foreground: #1A1A1A;

    /* BudgetThuis Action Blue - Primary Actions */
    --primary: #176fe4;
    --primary-foreground: #FFFFFF;

    /* BudgetThuis Brand Green - Sections & Branding */
    --brand-green: #3AAA35;
    --brand-yellow: #ffdb00;

    /* BudgetThuis Light Blue - Subtle backgrounds */
    --secondary: #EAF3FF;
    --secondary-foreground: #0F3750;

    --muted: #F3F4F6;
    --muted-foreground: #6B7280;

    --accent: #EAF3FF;
    --accent-foreground: #176fe4;

    --destructive: #EF4444;
    --destructive-foreground: #FFFFFF;

    --border: #E5E7EB;
    --input: #FFFFFF;
    --ring: #176fe4;

    /* Status colors */
    --online: #3AAA35;
    --offline: #EF4444;
    /* BudgetThuis uses red for offline/errors */
    --warning: #F59E0B;

    /* Chart colors */
    --chart-1: #176fe4;
    /* Blue */
    --chart-2: #3AAA35;
    /* Green */
    --chart-3: #ffdb00;
    /* Yellow */
    --chart-4: #0F3750;
    /* Deep Navy */
    --chart-5: #6B7280;

    --radius: 0px;
    /* Strictly rectangular */

    /* Sidebar - Seamless Deep Navy */
    --sidebar: #0F3750;
    --sidebar-foreground: #FFFFFF;
    --sidebar-primary: #3AAA35;
    --sidebar-primary-foreground: #FFFFFF;
    --sidebar-accent: #194a6b;
    --sidebar-accent-foreground: #FFFFFF;
    --sidebar-border: #0F3750;
    --sidebar-ring: #3AAA35;
}

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

html,
body {
    height: 100%;
    font-family: 'Open Sans', 'Geist', 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
}

/* ===== Layout ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.main-content {
    flex: 1;
    margin-left: 256px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: 24px;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: 256px;
    border-right: 1px solid var(--sidebar-border);
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    height: 64px;
    align-items: center;
    gap: 12px;
    background: #3AAA35;
    /* BudgetThuis Green Header */
    padding: 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    display: flex;
    height: 32px;
    width: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    /* Sharp as requested */
    background: white;
}

.sidebar-logo svg {
    height: 16px;
    width: 16px;
    color: var(--sidebar-primary-foreground);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--sidebar-foreground);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-foreground);
}

.sidebar-link.active {
    background: var(--sidebar-accent);
    color: var(--sidebar-foreground);
}

.sidebar-link svg {
    height: 16px;
    width: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 16px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-user-avatar {
    display: flex;
    height: 32px;
    width: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--sidebar-accent);
}

.sidebar-user-avatar svg {
    height: 16px;
    width: 16px;
    color: var(--sidebar-foreground);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: capitalize;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-foreground);
}

/* ===== Header ===== */
.header {
    display: flex;
    height: 64px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    padding: 0 24px;
}

.header-title-section h1 {
    font-family: 'Londrina Solid', sans-serif;
    font-size: 28px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 400;
    color: var(--foreground);
    margin: 0;
}

.header-title-section p {
    font-size: 14px;
    color: var(--muted-foreground);
    margin: 0;
}

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

.header-search {
    position: relative;
}

.header-search input {
    width: 256px;
    height: 36px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    /* White input */
    color: var(--foreground);
    font-size: 14px;
}

.header-search input::placeholder {
    color: var(--muted-foreground);
}

.header-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    width: 16px;
    color: var(--muted-foreground);
}

.header-notification {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
}

.header-notification:hover {
    background: var(--secondary);
}

.header-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: flex;
    height: 16px;
    min-width: 16px;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 10px;
    font-weight: 500;
    padding: 0 4px;
}

.header-avatar {
    display: flex;
    height: 32px;
    width: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(234, 88, 12, 0.2);
}

.header-avatar span {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
}

/* ===== Cards ===== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* Soft shadow for depth */
    transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px 24px 0;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
    padding-left: 12px;
    border-left: 4px solid #3AAA35;
    /* Green Accent Bar */
}

.card-description {
    font-size: 14px;
    color: var(--muted-foreground);
    margin: 0;
}

.card-content {
    padding: 24px;
}

.card-content.pt-0 {
    padding-top: 0;
}

/* ===== Metric Cards ===== */
.metric-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-card-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-card-icon {
    height: 16px;
    width: 16px;
    color: var(--muted-foreground);
}

.metric-card-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.metric-card-value span:first-child {
    font-size: 32px !important;
    font-weight: 700 !important;
    color: var(--foreground) !important;
    line-height: 1.2 !important;
}

.metric-card-value span:last-child {
    font-size: 14px;
    color: var(--muted-foreground);
}

.metric-card-trend {
    font-size: 12px;
}

.metric-card-trend.up {
    color: var(--online);
}

.metric-card-trend.down {
    color: var(--destructive);
}

.metric-card-trend.stable {
    color: var(--muted-foreground);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Londrina Solid', sans-serif;
    font-size: 18px;
    /* Londrina needs a bit more size to be legible */
    font-weight: 400;
    /* Regular weight for Londrina is quite bold already */
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 4px 0 #0a5194;
    /* 3D Block Shadow */
    transform: translateY(0);
}

.btn-primary:hover:not(:disabled) {
    background: #1462c9;
    box-shadow: 0 2px 0 #0a5194;
    transform: translateY(2px);
    /* Click feel */
}

.btn-primary::after {
    content: ' →';
    font-weight: 400;
}

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

.btn-secondary:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.1);
}

.btn-outline {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
}

.btn-outline:hover:not(:disabled) {
    background: var(--accent);
    color: var(--accent-foreground);
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--accent);
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
}

.btn-icon.btn-sm {
    height: 32px;
    width: 32px;
    padding: 0;
}

/* ===== Inputs ===== */
.input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FFFFFF;
    /* White input */
    color: var(--foreground);
    font-size: 14px;
    transition: border-color 0.15s ease;
}

.input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.1);
}

.input::placeholder {
    color: var(--muted-foreground);
}

.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-left: 36px;
}

.input-with-icon svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    width: 16px;
    color: var(--muted-foreground);
    pointer-events: none;
}

/* ===== Labels ===== */
.label {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

/* ===== Select ===== */
.select {
    height: 36px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--foreground);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
}

.select:focus {
    outline: none;
    border-color: var(--ring);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 500;
}

.badge-default {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-outline {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-foreground);
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--online);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

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

.badge-warning {
    background: rgba(234, 179, 8, 0.1);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

/* ===== Tables ===== */
.table-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}

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

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-foreground);
    background: transparent;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--foreground);
    border-bottom: 1px solid var(--border);
}

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

.table tr:hover td {
    background: var(--secondary);
    cursor: pointer;
}

.table th button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.table th button:hover {
    color: var(--foreground);
}

/* ===== Tabs ===== */
.tabs-list {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--secondary);
}

.tabs-trigger {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tabs-trigger:hover {
    color: var(--foreground);
}

.tabs-trigger.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

.tabs-content {
    margin-top: 16px;
}

/* ===== Status Indicators ===== */
.status-dot {
    display: inline-block;
    height: 8px;
    width: 8px;
    border-radius: 50%;
}

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

.status-dot.offline {
    background: var(--destructive);
}

.status-text.online {
    color: var(--online);
}

.status-text.offline {
    color: var(--muted-foreground);
}

/* ===== Progress Bars ===== */
.progress {
    height: 12px;
    border-radius: 9999px;
    background: var(--muted);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-bar.online {
    background: var(--online);
}

.progress-bar.offline {
    background: var(--offline);
}

.progress-bar.destructive {
    background: var(--destructive);
}

/* ===== Checkboxes ===== */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox {
    height: 16px;
    width: 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    cursor: pointer;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 10px;
}

.checkbox-label {
    font-size: 14px;
    color: var(--muted-foreground);
    cursor: pointer;
}

/* ===== Switches ===== */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 9999px;
    background: var(--input);
    cursor: pointer;
    transition: background 0.2s ease;
}

.switch.checked {
    background: var(--primary);
}

.switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.switch.checked::after {
    transform: translateX(20px);
}

/* ===== Module Cards ===== */
.module-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    transition: all 0.15s ease;
}

.module-card:hover {
    background: var(--secondary);
}

.module-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.1);
}

.module-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.module-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.module-card-status {
    font-size: 12px;
    font-weight: 500;
}

.module-card-status.charging {
    color: var(--online);
}

.module-card-status.discharging {
    color: var(--warning);
}

.module-card-status.idle {
    color: var(--muted-foreground);
}

.module-card-status.fault {
    color: var(--destructive);
}

.module-card-sn {
    font-size: 12px;
    font-family: 'Geist Mono', monospace;
    color: var(--muted-foreground);
    margin-bottom: 12px;
}

.module-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.module-card-metric {
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-card-metric svg {
    height: 12px;
    width: 12px;
    color: var(--muted-foreground);
}

.module-card-metric span {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.module-card-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.module-card-footer-label {
    color: var(--muted-foreground);
}

.module-card-footer-value {
    font-family: 'Geist Mono', monospace;
    color: var(--foreground);
}

/* ===== Charts ===== */
.chart-container {
    height: 420px;
    width: 100%;
}

.chart-loading {
    height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted-foreground);
}

.chart-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

.chart-empty {
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}

/* ===== Date Picker ===== */
.date-picker {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--secondary);
    color: var(--foreground);
    font-size: 14px;
}

.date-picker:focus {
    outline: none;
    border-color: var(--ring);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

.pagination-info {
    font-size: 14px;
    color: var(--muted-foreground);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--secondary);
}

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

.pagination-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* ===== Raw JSON Viewer ===== */
.raw-json-container {
    height: 500px;
    overflow-y: auto;
}

.raw-json-item {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.raw-json-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.raw-json-header:hover {
    background: var(--secondary);
}

.raw-json-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.raw-json-header-left svg {
    height: 16px;
    width: 16px;
    color: var(--muted-foreground);
}

.raw-json-header-id {
    font-size: 12px;
    font-family: 'Geist Mono', monospace;
    color: var(--muted-foreground);
}

.raw-json-header-time {
    font-size: 12px;
    color: var(--foreground);
}

.raw-json-copy {
    padding: 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
}

.raw-json-copy:hover {
    background: var(--secondary);
}

.raw-json-copy.copied {
    color: var(--online);
}

.raw-json-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.raw-json-content.expanded {
    max-height: 400px;
}

.raw-json-content pre {
    padding: 12px;
    margin: 0;
    font-size: 12px;
    font-family: 'Geist Mono', monospace;
    color: var(--foreground);
    background: rgba(0, 0, 0, 0.03);
    overflow-x: auto;
}

/* ===== Search Card ===== */
.search-card {
    border-color: rgba(234, 88, 12, 0.2);
    background: rgba(234, 88, 12, 0.05);
}

.search-card .card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-card .card-title svg {
    height: 20px;
    width: 20px;
    color: var(--primary);
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-form .input {
    flex: 1;
    background: var(--card);
}

.search-error {
    font-size: 14px;
    color: var(--destructive);
    margin-top: 8px;
}

/* ===== Stat Cards Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

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

.stats-grid-7 {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 1400px) {
    .stats-grid-7 {
        grid-template-columns: repeat(7, minmax(120px, 1fr));
        overflow-x: auto;
    }
}

@media (max-width: 1024px) {
    .stats-grid-7 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid-7 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.stat-card-icon {
    display: flex;
    height: 32px;
    width: 32px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--secondary);
}

.stat-card-icon svg {
    height: 15px;
    width: 15px;
    color: var(--muted-foreground);
}

.stat-card-icon.online {
    background: rgba(34, 197, 94, 0.1);
}

.stat-card-icon.online svg {
    color: var(--online);
}

.stat-card-icon.offline {
    background: rgba(107, 114, 128, 0.1);
}

.stat-card-icon.offline svg {
    color: var(--offline);
}

.stat-card-icon.destructive {
    background: rgba(239, 68, 68, 0.1);
}

.stat-card-icon.destructive svg {
    color: var(--destructive);
}

.stat-card-icon.primary {
    background: rgba(234, 88, 12, 0.1);
}

.stat-card-icon.primary svg {
    color: var(--primary);
}

.stat-card-icon.success {
    background: rgba(34, 197, 94, 0.1);
}

.stat-card-icon.success svg {
    color: var(--online);
}

.stat-card-icon.warning {
    background: rgba(251, 191, 36, 0.1);
}

.stat-card-icon.warning svg {
    color: var(--warning);
}

.stat-card-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.2;
}

.stat-card-value.online {
    color: var(--online);
}

.stat-card-value.offline {
    color: var(--offline);
}

.stat-card-value.destructive {
    color: var(--destructive);
}

.stat-card-label {
    font-size: 11px;
    color: var(--muted-foreground);
    line-height: 1.3;
    margin-top: 2px;
}

/* ===== Empty Slot ===== */
.empty-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.02);
}

.empty-slot span {
    font-size: 14px;
    color: var(--muted-foreground);
}

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    padding-bottom: 8px;
}

.login-logo {
    display: inline-flex;
    height: 56px;
    width: 56px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--primary);
    margin-bottom: 16px;
}

.login-logo svg {
    height: 28px;
    width: 28px;
    color: var(--primary-foreground);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--muted-foreground);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 16px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--destructive);
    font-size: 14px;
}

.login-error svg {
    height: 16px;
    width: 16px;
    flex-shrink: 0;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-demo {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.login-demo-title {
    font-size: 12px;
    color: var(--muted-foreground);
    text-align: center;
    margin-bottom: 8px;
}

.login-demo-accounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.login-demo-account {
    padding: 8px;
    border-radius: 8px;
    background: var(--secondary);
}

.login-demo-account-role {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 4px;
}

.login-demo-account p {
    font-size: 12px;
    color: var(--muted-foreground);
    margin: 0;
}

/* ===== Grid Layouts ===== */
.grid {
    display: grid;
    gap: 16px;
}

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

.col-span-2 {
    grid-column: span 2;
}

/* ===== Flexbox Utilities ===== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

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

.flex-1 {
    flex: 1;
}

/* ===== Spacing Utilities ===== */
.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.pt-4 {
    padding-top: 16px;
}

/* ===== Text Utilities ===== */
.text-sm {
    font-size: 14px;
}

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

.text-lg {
    font-size: 18px;
}

.text-xl {
    font-size: 20px;
}

.text-2xl {
    font-size: 24px;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.text-muted {
    color: var(--muted-foreground);
}

.text-foreground {
    color: var(--foreground);
}

.text-primary {
    color: var(--primary);
}

.text-online {
    color: var(--online);
}

.text-offline {
    color: var(--offline);
}

.text-destructive {
    color: var(--destructive);
}

.text-warning {
    color: var(--warning);
}

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

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

.font-mono {
    font-family: 'Geist Mono', monospace;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Border Utilities ===== */
.border-t {
    border-top: 1px solid var(--border);
}

.border-b {
    border-bottom: 1px solid var(--border);
}

/* ===== Width/Height Utilities ===== */
.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

/* ===== Rounded Utilities ===== */
.rounded {
    border-radius: var(--radius);
}

.rounded-lg {
    border-radius: 8px;
}

.rounded-full {
    border-radius: 9999px;
}

/* ===== Background Utilities ===== */
.bg-muted {
    background: var(--muted);
}

.bg-secondary {
    background: var(--secondary);
}

.bg-card {
    background: var(--card);
}

/* ===== Activity Item ===== */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
}

.activity-icon {
    display: flex;
    height: 40px;
    width: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.activity-icon.success {
    background: rgba(34, 197, 94, 0.2);
}

.activity-icon.success svg {
    color: var(--online);
}

.activity-icon.warning {
    background: rgba(234, 179, 8, 0.2);
}

.activity-icon.warning svg {
    color: var(--warning);
}

.activity-icon.info {
    background: rgba(234, 88, 12, 0.2);
}

.activity-icon.info svg {
    color: var(--accent-foreground);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.activity-time {
    font-size: 12px;
    color: var(--muted-foreground);
}

.activity-description {
    font-size: 14px;
    color: var(--muted-foreground);
}

/* ===== Notification Channel ===== */
.notification-channel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
}

.notification-channel-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-channel-icon {
    display: flex;
    height: 40px;
    width: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--secondary);
}

.notification-channel-icon svg {
    height: 20px;
    width: 20px;
    color: var(--muted-foreground);
}

.notification-channel-target {
    font-size: 14px;
    font-weight: 500;
    font-family: 'Geist Mono', monospace;
    color: var(--foreground);
}

.notification-channel-last-used {
    font-size: 12px;
    color: var(--muted-foreground);
}

.notification-channel-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ===== Notification Outbox Item ===== */
.outbox-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
}

.outbox-item-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.outbox-item-left svg {
    height: 16px;
    width: 16px;
}

.outbox-item-left svg.success {
    color: var(--online);
}

.outbox-item-left svg.pending {
    color: var(--warning);
}

.outbox-item-left svg.failed {
    color: var(--destructive);
}

.outbox-item-type {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.outbox-item-device {
    font-size: 12px;
    color: var(--muted-foreground);
}

.outbox-item-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--muted-foreground);
}

/* ===== Future Extension Card ===== */
.future-card {
    border-style: dashed;
}

.future-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
}

.future-item h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
    margin: 0 0 4px;
}

.future-item p {
    font-size: 12px;
    color: var(--muted-foreground);
    margin: 0;
}

.future-item .badge {
    margin-top: 8px;
}

/* ===== P1 Meter Card ===== */
.p1-meter-card {
    margin-top: 24px;
}

.p1-meter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.p1-meter-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.p1-meter-title svg {
    height: 20px;
    width: 20px;
    color: var(--primary);
}

.p1-meter-phases {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.p1-phase {
    padding: 16px;
    border-radius: 8px;
    background: var(--secondary);
}

.p1-phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.p1-phase-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.p1-phase-power {
    font-size: 18px;
    font-weight: 600;
}

.p1-phase-power.negative {
    color: var(--online);
}

.p1-phase-power.positive {
    color: var(--primary);
}

.p1-phase-details {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--muted-foreground);
}

.p1-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.p1-total-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--foreground);
}

.p1-total-label {
    font-size: 12px;
    color: var(--muted-foreground);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

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

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

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

/* ===== Loading Animation ===== */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.skeleton {
    background: var(--muted);
    border-radius: 4px;
    animation: pulse 2s ease-in-out infinite;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* ===== Blazor Error UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ===== Modal Styles ===== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--muted);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-list-item:hover {
    background: var(--accent);
}

/* ===== Notification Styles ===== */
.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--destructive);
}

.notification-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.notification-icon.info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.notification-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px;
    background: var(--muted);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.notification-row:hover {
    background: var(--accent);
}

.notification-row.error {
    border-left-color: var(--destructive);
}

.notification-row.warning {
    border-left-color: var(--warning);
}

.notification-row.info {
    border-left-color: var(--primary);
}

.notification-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--destructive);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.progress-bar.primary {
    background: var(--primary);
}

/* ===== Dashboard Section Styles ===== */
.dashboard-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon.batteries {
    background: rgba(34, 197, 94, 0.15);
    color: var(--online);
}

.section-icon.p1meters {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.section-icon.customers {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.section-icon.notifications {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Alert styles */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

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

/* Customer Metrics Connectivity */
.customer-metrics-container {
    background: var(--muted);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.customer-metrics-container .metric-card {
    background: var(--card);
}

/* Ensure horizontal grid doesn't wrap too easily */
.dashboard-section .grid {
    display: grid;
    width: 100%;
}

.grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1400px) {
    .grid-cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid-cols-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {

    .grid-cols-6,
    .grid-cols-5,
    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}