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

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

body {
    font-family: 'Rubik', sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
    line-height: 1.5;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
}

.logo i {
    font-size: 1.5rem;
    color: #38bdf8;
    margin-right: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f8fafc;
}

nav ul {
    display: flex;
    list-style: none;
}

nav li {
    margin-right: 1.5rem;
}

nav a {
    text-decoration: none;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

nav a i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

nav li.active a {
    color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.1);
}

nav a:hover {
    color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.05);
}

.user {
    display: flex;
    align-items: center;
}

.user span {
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: #38bdf8;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Main Content */
main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

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

.dashboard-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f8fafc;
}

.actions {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn i {
    margin-right: 0.5rem;
}

.btn.primary {
    background-color: #38bdf8;
    color: #0f172a;
}

.btn.primary:hover {
    background-color: #0ea5e9;
}

.btn.secondary {
    background-color: #334155;
    color: #f8fafc;
}

.btn.secondary:hover {
    background-color: #475569;
}

.btn.small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

.stat-card {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background-color: rgba(56, 189, 248, 0.1);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #38bdf8;
}

.stat-info {
    flex: 1;
    margin-left: 1rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #94a3b8;
}

.stat-chart {
    width: 80px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chart Styles */
.bar-chart {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.bar {
    width: 4px;
    background-color: #38bdf8;
    border-radius: 2px;
}

.gauge {
    width: 48px;
    height: 48px;
    position: relative;
    border-radius: 50%;
    background-color: #334155;
    overflow: hidden;
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(#38bdf8 0%, transparent 0%);
    opacity: 0.8;
    transform-origin: center;
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background-color: #1e293b;
    border-radius: 50%;
}

.line-chart {
    width: 100%;
    height: 100%;
}

.line-chart svg {
    width: 100%;
    height: 100%;
}

.line-chart polyline {
    fill: none;
    stroke: #38bdf8;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Infrastructure Diagram */
.infra-diagram {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.infra-diagram h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #f8fafc;
    font-weight: 500;
}

.diagram-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

.node {
    background-color: #334155;
    border-radius: 0.5rem;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    min-width: 150px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #3e536b;
}

.node i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.node span {
    font-size: 0.9rem;
    font-weight: 500;
}

.load-balancer {
    background-color: #4f46e5;
    color: #f8fafc;
}

.load-balancer i {
    color: #c4b5fd;
}

.status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.status.active {
    background-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status.warning {
    background-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.status.error {
    background-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.servers-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.server-row, .storage-row {
    display: flex;
    justify-content: space-around;
    width: 100%;
    position: relative;
}

.server-row::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    width: 2px;
    height: 30px;
    background-color: #475569;
    z-index: 1;
}

.server-row:first-child::before {
    display: none;
}

.storage-row::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    width: 2px;
    height: 30px;
    background-color: #475569;
    z-index: 1;
}

/* Details Panel */
.infra-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.health-panel, .metrics-panel {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.health-panel h3, .metrics-panel h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.health-logs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.log-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: #334155;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.log-time {
    color: #94a3b8;
    margin-right: 0.75rem;
    min-width: 70px;
}

.log-status {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-right: 0.75rem;
    min-width: 50px;
    text-align: center;
}

.log-status.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.log-status.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.log-status.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.log-status.info {
    background-color: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

.log-message {
    color: #cbd5e1;
}

.metrics-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.metric {
    background-color: #334155;
    border-radius: 0.25rem;
    padding: 1rem;
}

.metric h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #cbd5e1;
}

.metric-chart {
    height: 100px;
    position: relative;
}

.metric-chart svg {
    width: 100%;
    height: 100%;
}

.metric-chart polyline.in {
    fill: none;
    stroke: #38bdf8;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.metric-chart polyline.out {
    fill: none;
    stroke: #a855f7;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.legend-item {
    display: flex;
    align-items: center;
}

.in-color, .out-color {
    display: block;
    width: 12px;
    height: 4px;
    margin-right: 0.5rem;
    border-radius: 2px;
}

.in-color {
    background-color: #38bdf8;
}

.out-color {
    background-color: #a855f7;
}

/* Scaling Controls */
.panel-section {
    background-color: #1e293b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.panel-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    font-weight: 500;
    color: #f8fafc;
}

.scaling-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.toggle {
    position: relative;
    display: inline-block;
}

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

.toggle label {
    display: block;
    width: 50px;
    height: 24px;
    border-radius: 12px;
    background-color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.toggle label::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

.toggle input:checked + label {
    background-color: #38bdf8;
}

.toggle input:checked + label::after {
    transform: translateX(26px);
}

.range-control {
    display: flex;
    align-items: center;
}

.range-control input {
    flex: 1;
    height: 6px;
    appearance: none;
    background-color: #475569;
    border-radius: 3px;
    outline: none;
    margin-right: 0.75rem;
}

.range-control input::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #38bdf8;
    cursor: pointer;
}

.range-value {
    font-weight: 500;
    min-width: 30px;
    color: #f8fafc;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background-color: #1e293b;
    border-top: 1px solid #334155;
    font-size: 0.85rem;
    color: #94a3b8;
}

.status-bar {
    display: flex;
    gap: 1.5rem;
}

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

.status-item i {
    margin-right: 0.5rem;
}

.status-item i.active {
    color: #10b981;
}

/* Node Details Popup */
.node-details {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    background-color: #1e293b;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #334155;
}

.details-header h4 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #f8fafc;
}

.close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #f8fafc;
}

.details-content {
    padding: 1.5rem;
}

.details-section {
    margin-bottom: 1.5rem;
}

.details-section h5 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-item {
    display: flex;
    margin-bottom: 0.5rem;
}

.details-item .label {
    min-width: 100px;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.details-item .value {
    font-weight: 500;
    color: #f8fafc;
    font-size: 0.9rem;
}

.details-item .status-active {
    color: #10b981;
}

.details-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chart-item {
    display: flex;
    align-items: center;
}

.chart-label {
    min-width: 50px;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background-color: #475569;
    border-radius: 4px;
    margin: 0 0.75rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #38bdf8;
    border-radius: 4px;
}

.chart-value {
    min-width: 40px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 500;
    color: #f8fafc;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .infra-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 1rem;
    }
    
    nav ul {
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    nav li {
        margin: 0.25rem;
    }
    
    .user {
        margin-top: 1rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .metrics-container {
        grid-template-columns: 1fr;
    }
    
    .server-row, .storage-row {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .server-row::before, .storage-row::before {
        display: none;
    }
    
    .node-details {
        width: 90%;
        max-width: 400px;
    }
}
