:root {
    --primary-color: #0071e3;
    --primary-dark: #0062c4;
    --primary-light: #e6f1fa;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --dark-color: #1d1d1f;
    --light-color: #f5f5f7;
    --gray-color: #86868b;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(255, 255, 255, 0.2);
    --glass-effect: blur(20px);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f5f7 0%, #e5e5ea 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--card-bg);
    backdrop-filter: var(--glass-effect);
    border-radius: 18px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
}

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

.logo-icon {
    font-size: 24px;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.status-indicator {
    position: relative;
    width: 24px;
    height: 24px;
}

.light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--gray-color);
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
}

.pulse {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 113, 227, 0.4);
    border-radius: 50%;
    animation: pulse 2s infinite;
    z-index: 1;
}

.time-display {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.dashboard {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 20px;
    flex: 1;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-section {
    background: var(--card-bg);
    backdrop-filter: var(--glass-effect);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(0, 113, 227, 0.1);
    border: none;
    border-radius: 12px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(0, 113, 227, 0.2);
}

.action-btn i {
    font-size: 16px;
}

.badge {
    background-color: var(--danger-color);
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    margin-left: auto;
}

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.data-visualization {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 20px;
}

.metric-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-effect);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
}

.metric-card.large {
    grid-column: span 1;
    grid-row: span 1;
}

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

.metric-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.metric-topic {
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 8px;
    border-radius: 10px;
}

.metric-value {
    font-size: 42px;
    font-weight: 600;
    margin: 10px 0;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.trend-up {
    color: var(--danger-color);
}

.trend-down {
    color: var(--success-color);
}

.gauge-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.gauge {
    height: 8px;
    width: 100%;
    background: linear-gradient(90deg, var(--success-color) 0%, var(--warning-color) 50%, var(--danger-color) 100%);
    border-radius: 4px;
    position: relative;
}

.gauge::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    right: 30%;
    transform: translateX(50%);
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.health-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
}

.health-item i {
    font-size: 24px;
}

.health-item.online i {
    color: var(--success-color);
}

.health-item.warning i {
    color: var(--warning-color);
}

.health-item.offline i {
    color: var(--danger-color);
}

.notification-panel {
    background: var(--card-bg);
    backdrop-filter: var(--glass-effect);
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.03);
}

.notification-item.critical {
    background: rgba(255, 59, 48, 0.1);
    border-left: 3px solid var(--danger-color);
}

.notification-item.warning {
    background: rgba(255, 149, 0, 0.1);
    border-left: 3px solid var(--warning-color);
}

.notification-item.info {
    background: rgba(0, 113, 227, 0.1);
    border-left: 3px solid var(--primary-color);
}

.notification-icon {
    font-size: 18px;
    margin-top: 2px;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-time {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: right;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--card-bg);
    backdrop-filter: var(--glass-effect);
    border-radius: 18px;
    margin-top: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--card-border);
    font-size: 12px;
    color: var(--text-secondary);
}

.footer-info, .footer-stats {
    display: flex;
    gap: 20px;
}

.footer-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.7;
    }
    70% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .dashboard {
        grid-template-columns: 250px 1fr;
    }
    .notification-panel {
        grid-column: span 2;
    }
}

@media (max-width: 1000px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    .notification-panel {
        grid-column: span 1;
    }
    .data-visualization {
        grid-template-columns: 1fr;
    }
}