// Variables
$transition-speed: var(--transition);
$border-radius: 8px;
$spacing-unit: 1rem;

// Mixins
@mixin flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

@mixin card {
    background: var(--background);
    border-radius: $border-radius;
    box-shadow: var(--transp-2);
    transition: transform $transition-speed, box-shadow $transition-speed;

    &:hover {
        transform: translateY(-2px);
        box-shadow: var(--transp-4);
    }
}

// Server Status
.server-status {
    margin-top: $spacing-unit * 2;

    &-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: $spacing-unit * 1.5;
    }

    &-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }

    &-badge {
        padding: 0.5rem 1rem;
        border-radius: 20px;
        font-size: 0.875rem;
        font-weight: 500;

        &[data-status="online"] {
            background: var(--success-light);
            color: var(--success);
        }

        &[data-status="offline"] {
            background: var(--error-light);
            color: var(--error);
        }

        &[data-status="maintenance"] {
            background: var(--warning-light);
            color: var(--warning);
        }
    }
}

.server-metrics {
    &-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: $spacing-unit;
        margin-bottom: $spacing-unit * 2;
    }
}

.server-metric {
    @include card;
    padding: $spacing-unit;
    display: flex;
    align-items: center;
    gap: $spacing-unit;

    &[data-type="load"] .server-metric-icon {
        color: var(--warning);
    }

    &[data-type="memory"] .server-metric-icon {
        color: var(--info);
    }

    &[data-type="players"] .server-metric-icon {
        color: var(--success);
    }

    &[data-type="uptime"] .server-metric-icon {
        color: var(--accent);
    }

    &-icon {
        width: 42px;
        height: 42px;
        @include flex-center;
        background: var(--transp-1);
        border-radius: $border-radius;
        font-size: 1.25rem;
    }

    &-content {
        flex: 1;
    }

    &-value {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
        display: block;
    }

    &-label {
        font-size: 0.875rem;
        color: var(--text-500);
        display: block;
        margin-top: 0.25rem;
    }
}

.server-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: $spacing-unit * 2;
    margin-top: $spacing-unit * 2;

    @media (max-width: 768px) {
        grid-template-columns: 1fr;
    }
}

.server-chart {
    @include card;
    padding: $spacing-unit * 1.5;

    &-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        margin: 0 0 $spacing-unit;
    }

    &-container {
        height: 200px;
    }
}

// Server Connections
.server-connections {
    &-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: $spacing-unit * 1.5;
    }

    &-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }

    &-empty {
        @include card;
        padding: $spacing-unit * 3;
        text-align: center;

        &-icon {
            font-size: 3rem;
            color: var(--text-500);
            margin-bottom: $spacing-unit;
        }

        &-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text);
            margin: 0 0 $spacing-unit * 0.5;
        }

        &-text {
            color: var(--text-500);
            margin: 0;
        }
    }
}

.connection {
    &-type {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;
    }

    &-host {
        font-family: monospace;
        font-size: 0.875rem;

        &-port {
            color: var(--text-500);
        }
    }

    &-status {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;

        &-indicator {
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }

        &[data-status="active"] {
            color: var(--success);
            .connection-status-indicator {
                background: var(--success);
            }
        }

        &[data-status="inactive"] {
            color: var(--error);
            .connection-status-indicator {
                background: var(--error);
            }
        }

        &[data-status="pending"] {
            color: var(--warning);
            .connection-status-indicator {
                background: var(--warning);
            }
        }
    }

    &-actions {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
    }
}

// Server Logs
.server-logs {
    &-header {
        margin-bottom: $spacing-unit * 1.5;
    }

    &-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
        margin: 0 0 $spacing-unit;
    }

    &-filters {
        display: flex;
        gap: $spacing-unit;
        flex-wrap: wrap;

        @media (max-width: 768px) {
            flex-direction: column;
        }
    }

    &-filter {
        flex: 1;
        min-width: 200px;
    }

    &-actions {
        display: flex;
        gap: $spacing-unit;
    }

    &-content {
        height: 500px;
        overflow-y: auto;
        padding: $spacing-unit;
        background: var(--transp-1);
        border-radius: $border-radius;
    }

    &-loading {
        @include flex-center;
        flex-direction: column;
        gap: $spacing-unit;
        height: 100%;
        color: var(--text-500);
    }

    &-empty {
        @include flex-center;
        flex-direction: column;
        height: 100%;
        color: var(--text-500);
        text-align: center;

        &-icon {
            font-size: 3rem;
            margin-bottom: $spacing-unit;
        }
    }
}

.server-log {
    &-item {
        display: flex;
        gap: $spacing-unit;
        padding: $spacing-unit;
        border-radius: $border-radius;
        margin-bottom: $spacing-unit;
        background: var(--background);

        &[data-level="info"] {
            border-left: 3px solid var(--info);
        }

        &[data-level="warning"] {
            border-left: 3px solid var(--warning);
        }

        &[data-level="error"] {
            border-left: 3px solid var(--error);
        }

        &[data-level="critical"] {
            border-left: 3px solid var(--error);
            background: var(--error-light);
        }
    }

    &-icon {
        width: 24px;
        height: 24px;
        @include flex-center;
        flex-shrink: 0;

        [data-level="info"] & {
            color: var(--info);
        }

        [data-level="warning"] & {
            color: var(--warning);
        }

        [data-level="error"] & {
            color: var(--error);
        }

        [data-level="critical"] & {
            color: var(--error);
        }
    }

    &-content {
        flex: 1;
    }

    &-meta {
        display: flex;
        gap: $spacing-unit;
        margin-bottom: 0.5rem;
        font-size: 0.75rem;
        color: var(--text-500);
    }

    &-message {
        color: var(--text);
        margin-bottom: 0.5rem;
        line-height: 1.5;
    }

    &-details {
        font-family: monospace;
        font-size: 0.875rem;
        background: var(--transp-1);
        padding: $spacing-unit;
        border-radius: $border-radius;
        margin: 0;
        white-space: pre-wrap;
    }
} 